December 2021

Welcome

Outline

In this workshop, we have three parts:

  • Delivering TLFs in CSR (Yilong Zhang)
    • Session 1 (45 min)
    • Break and/or Exercise (20 min)
    • Session 2 (45 min)
    • Break (10 min)
  • Clinical trial project (Nan Xiao)
    • Session 3 (30 min)
    • Break (10 min)
  • eCTD submission package (Nan Xiao)
    • Session 4 (40 min)
    • Q&A (10 min)

Disclaimer

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

Training objective

  • Learning how to create tables for clinical study reports.
  • Learning how to organize a clinical development project.
  • Learning how to prepare eCTD submission package to FDA.

The toolchain, process, and formats may be different in different organizations. We only provide a recommended way to address them.

Acknowledgement

  • Team members from Merck & Co.
  • Contributors of the training materials.
    • Please consider submitting issues or PR in the repo.
  • R Consortium
    • R validation hub
    • Submission working group
    • R Tables for Regulatory Submission (RTRS) working group
    • Please consider to join and contribute to a working group.
  • ASA Princeton-Trenton Chapter
    • Please consider to be a member of our chapter.

Preparation

In this workshop, we assume you have some R programming experience and clinical development knowledge.

  • Data manipulation: tidyverse, dplyr, tidyr, ggplot2 etc.
  • ADaM data: adsl, adae etc.
install.packages(c(
  "tidyverse", # Data manipulation
  "r2rtf",     # TLF generation
  "pkglite"    # eCTD submission
))

Resource

Philosophy

We share the same philosophy described in Section 1.1 of the 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.”

Delivering TLFs in CSR

ICH E3 guidance

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

  • Section 10: Study patients
  • Section 11: Efficacy evaluation
  • Section 12: Safety evaluation
  • Section 14: Tables, Figures and Graphs referred to but not included in the text
  • Section 16: Appendices

Datasets

Tools

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

r2rtf introduction

Motivation

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:

  • provide simple “verb” functions that correspond to each component of a table, to help you translate a data frame to a table in RTF format;
  • enable pipes (%>%);
  • only focus on the table format.
    • Data manipulation and analysis should be handled by other R packages. (e.g., tidyverse)

Workflow

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.

Minimal example

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

Package overview

r2rtf package provides the flexibility to customize table appearance for

  • Table component: title, column header, footnote, etc.
  • Table cell style: size, border type, color, font size, text color, alignment, etc.
  • Flexible control: the specification of the cell style can be row or column vectorized.
  • Complicated format: pagination, section grouping, multiple table concatenations, etc.

r2rtf package also provides the flexibility to convert figures in RTF format.

Simple example: adverse events

r2rtf only focus on table format. Data manipulation and analysis should be handled by other R packages. (e.g., tidyverse)

Function summary

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

Function illustration

Break and/or exercise (20 min)

CSR examples

Disposition table

Analysis population

Baseline characteristics

Efficacy table

AE Summary table

Specific AE table

Break (10 min)

Clinical trial project

Overview

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.

Folder structure

Our primary focus is creating a standard R package structure to organize the project, with 4 goals in mind:

  • Consistency
  • Reproducibility
  • Automation
  • Compliance

https://r4csr.org/project-folder.html

Project management

Break (10 min)

eCTD submission

Overview

Submission package

We will discuss strategies to prepare proprietary R packages and analysis code into proper formats for submission:

  • The whole game
  • Practical considerations
  • Prepare R packages using pkglite
  • Prepare analysis programs
  • Update ADRG and ARM

https://r4csr.org/submission-package.html

Running environment

pkglite

pkglite: compact package representations

  • To provide a tool for packing and restoring R packages as plaintext assets that are easy to store, transfer, and review.
  • To provide a grammar for specifying the file packing scope that is functional, precise, and extendable.
  • To provide a standard for exchanging the packed asset that is unambiguous, human-friendly, and machine-readable.

Pipe-friendly workflow

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 + file collections

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

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

Q&A