September 2022
In this workshop, we have three parts:
All opinions expressed are those of the presenter.
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/)esubdemo
project to your local RStudio IDE.As an organization, we need to ensure compliance and reduce the risk of using R and R packages in regulatory deliverables.
gsDesign
: an R package for group sequential design under proportional hazards.simtrial
, gsDesign2
, and gsdmvn
: experimental R packages for group sequential design under non-proportional hazardsWe 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 provides 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.
The dataset structure follows the CDISC Analysis Data Model (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 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:
“FDA does not require use of any specific software for statistical analyses, and statistical software is not explicitly discussed in Title 21 of the Code of Federal Regulations [e.g., in 21CFR part 11]. However, the software package(s) used for statistical analyses should be fully documented in the submission, including version and build identification.”
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
Diao, Guoqing, Guanghan F Liu, Donglin Zeng, Yilong Zhang, Gregory Golm, Joseph F Heyse, and Joseph G Ibrahim. 2020. “Efficient Multiple Imputation for Sensitivity Analysis of Recurrent Events Data with Informative Censoring.” Statistics in Biopharmaceutical Research, 1–9.
Gao, Fei, Guanghan F Liu, Donglin Zeng, Lei Xu, Bridget Lin, Guoqing Diao, Gregory Golm, Joseph F Heyse, and Joseph G Ibrahim. 2017. “Control-Based Imputation for Sensitivity Analyses in Informative Censoring for Recurrent Event Data.” Pharmaceutical Statistics 16 (6): 424–32.
Lachin, John M, and Mary A Foulkes. 1986. “Evaluation of Sample Size and Power for Analyses of Survival with Allowance for Nonuniform Patient Entry, Losses to Follow-up, Noncompliance, and Stratification.” Biometrics, 507–19.
Liu, Siyi, Shu Yang, Yilong Zhang, et al. 2021. “Multiply Robust Estimators in Longitudinal Studies with Missing Data Under Control-Based Imputation.” arXiv Preprint arXiv:2112.06000.