January 2022


  • 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.

Clarification from FDA

“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.”


As an organization, we need to ensure compliance and reduce the risk of using R and R packages in regulatory deliverables.


  • Clinical study report is a key deliverable for clinical trials to regulatory agencies. (e.g., FDA, CFDA)
  • We try to fill in gaps to streamline workflow using R for clinical trial development:
    • To develop, validate, and deliver analysis results.
    • To submit analysis results to regulatory agencies in eCTD format.
  • Focus on table, listing, figure (TLFs) delivered in RTF/Microsoft Word format
    • In the pharmaceutical industry, RTF/Microsoft Word play a central role in preparing clinical study reports.
    • Different organization can have different table standards

R Consortium pilot submission

Challenges and assumptions


  • How to submit internal developed (proprietary) R packages?
  • How to follow ICH and/or FDA guidances in preparing eCTD package?
  • How to enhance reproducibility from FDA reviewer’s perspective?


  • Focus on analysis and reporting given available ADaM datasets.


FDA response

  • “Using R version 4.1.1, FDA was able to run the submitted code and confirm the applicant’s tables and the submitted figure in report-tlf pdf file.”
  • “Using FDA developed code, a statistical analyst was able to independently generate tables using the submitted data.”
  • Original FDA response

Future work

  • Address minor issues reported by FDA reviewers.
  • Pilot R Shiny app submission.
  • Pilot submission with advanced analysis methods (e.g., study design, missing data, Bayesian, etc).


Reproducibility spectrum

Requirement from FDA

“Sponsors should provide the software programs used to create all ADaM datasets and generate tables and figures associated with primary and secondary efficacy analyses. Furthermore, sponsors should submit software programs used to generate additional information included in Section 14 CLINICAL STUDIES of the Prescribing Information (PI)26 if applicable. The specific software utilized should be specified in the ADRG. The main purpose of requesting the submission of these programs is to understand the process by which the variables for the respective analyses were created and to confirm the analysis algorithms. Sponsors should submit software programs in ASCII text format; however, executable file extensions should not be used.”


Although FDA did not expect submitted R code is executable, sponsor shall enhance reproducibility.



We share the same philosophy described in Section 1.1 of R Packages book and quote here.

  • “Anything that can be automated, should be automated.”
  • “Do as little as possible by hand. Do as much as possible with functions.”
  • “The goal is to spend your time thinking about what you want to do rather than thinking about the minutiae of package structure.”

Tools for reporting and submission


  • r2rtf: create production-ready tables and figures in RTF format.
  • pkglite: represent and exchange R package source code as text files.
  • cleanslate (under internal validation): create portable R environments.

Bookdown: https://r4csr.org/

r2rtf: design

r2rtf is designed to:

  • Generate highly customized tables
  • Limit package dependency
  • Target regulatory deliverable
  • Support pipes (%>%)

r2rtf: minimal example

r2rtf is designed to be pipe-friendly (%>%)

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: function illustration