December 2021
In this workshop, we have three parts:
All opinions expressed are those of the presenter and not Merck Sharp & Dohme Corp., a subsidiary of Merck & Co., Inc., Kenilworth, NJ, USA.
Some slides need to be scrolled down to see the full content.
The toolchain, process, and formats may be different in different organizations. We only provide a recommended way to address them.
In this workshop, we assume you have some R programming experience and clinical development knowledge.
adsl
, adae
etc.install.packages(c( "tidyverse", # Data manipulation "r2rtf", # TLF generation "pkglite" # eCTD submission ))
esubdemo
project.
esubdemo
is shared in Posit Cloud (https://posit.cloud/)We share the same philosophy described in Section 1.1 of the R Packages book and quote here.
The ICH E3: structure and content of clinical study reports provide guidance to assist sponsors in the development of a CSR.
In a CSR, most of TLFs are located in
Public available CDISC pilot study data located at CDISC GitHub repository.
The dataset structure follows the CDISC Analysis Data Model (ADaM).
Source data: https://github.com/elong0527/r4csr/tree/master/data-adam
tidyverse: a collection of R packages to simplify the workflow to manipulate, visualize and analyze data in R.
r2rtf: an R package to create production-ready tables and figures in RTF format.
In the pharmaceutical industry, RTF/Microsoft Word play a central role in preparing clinical study reports
Different organizations can have different table standards
E.g., Table layout, Font size, Border type, Footnote, Data source
r2rtf is an R package to create production-ready tables and figures in RTF format.
r2rtf is designed to:
%>%
);Before creating an RTF table, we need to:
Figure out table layout.
Split the layout into small tasks in the form of a computer program.
Execute the program.
r2rtf is designed to enable pipes (%>%
).
head(iris) %>% rtf_body() %>% # Step 1 Add table attributes rtf_encode() %>% # Step 2 Convert attributes to RTF encode write_rtf("minimal.rtf") # Step 3 Write to a .rtf file
r2rtf package provides the flexibility to customize table appearance for
r2rtf package also provides the flexibility to convert figures in RTF format.
r2rtf only focus on table format. Data manipulation and analysis should be handled by other R packages. (e.g., tidyverse)
r2rtf provides simple “verb” functions that correspond to each component of a table, to help you translate data frame to tables in RTF file.
Functions | Purpose | Optional/required |
---|---|---|
rtf_page_header() | add page header | optional |
rtf_title() | add title | optional |
rtf_subline() | add subject line | optional |
rtf_colheader() | add column header | optional |
rtf_body() | add table body | required |
rtf_footnote() | add footnote | optional |
rtf_source() | add data source | optional |
rtf_page_footer() | add page footer | optional |
rtf_encode() | convert table into rtf code | required |
write_rtf() | write rtf code into .rtf file | required |
In a late-stage clinical trial, the number of A&R deliverables can easily be in the hundreds.
For an organization, it is also common to have multiple ongoing clinical trials in a clinical program.
In this part, let’s consider how to organize a clinical trial project as an A&R lead.
Our primary focus is creating a standard R package structure to organize the project, with 4 goals in mind:
We will discuss strategies to prepare proprietary R packages and analysis code into proper formats for submission:
pkglite
We will also give recommendations to make the R code running environment reproducible for dry run tests and reviews using cleanslate
.
library("pkglite") "/path/to/pkg/" %>% collate(file_ectd()) %>% pack() pack( "/path/to/pkg1/" %>% collate(file_ectd()), "/path/to/pkg2/" %>% collate(file_ectd()), output = "/path/to/pkglite.txt" ) "/path/to/pkglite.txt" %>% unpack(output = "/path/to/output/")
File specifications offer flexibility and brevity in specifying the files to include.
File specification type | Functions |
---|---|
Manual discovery | file_spec() |
Automatic discovery | file_auto() |
Common patterns | file_root_core() , file_r() , file_man() , file_src() , file_vignettes() , … |
Default sets | file_default() , file_ectd() |
File collections contain the evaluation results of file specifications for packing.
library("pkglite") "/path/to/pkg" %>% collate(file_root_core(), file_r(), file_auto("inst/"))
pkglite.txt follows the standard Debian Control File (DCF) format used by Debian, R, and RStudio IDE, to be both machine-readable and human-readable.
# Generated by pkglite: do not edit by hand # Use pkglite::unpack() to restore the packages Package: pkg1 File: DESCRIPTION Format: text Content: Package: pkg1 Type: Package Title: Example Package One Version: 0.1.0