Clinical Programming with R

The full submission pipeline, in R

12 lessons Intermediate to advanced ~30 hours Exercises with solutions

For thirty years, clinical trial reporting meant SAS. That is changing — not because R is fashionable, but because sponsors have submitted R-based analyses to the FDA and PMDA and had them accepted, because the pharmaverse now covers the whole pipeline, and because the people entering the industry learned R at university.

This course covers that pipeline end to end: reading source data, building SDTM and ADaM, producing tables listings and figures, validating the result, and preparing a define.xml and transport files for submission.

Who this is for

  • SAS programmers who need to work in R, or lead a team that does
  • Statisticians and data scientists moving into clinical trials
  • Anyone evaluating whether R is viable for regulated reporting
  • Teams planning a SAS-to-R migration

You need the material in R Programming — particularly functions, tidy evaluation, testing and packages. Familiarity with CDISC standards helps but is not assumed; each lesson introduces what it needs.

What you will be able to do

Build an ADaM dataset from SDTM with admiral, produce a submission-quality RTF table with r2rtf, apply xportr to meet transport requirements, generate define.xml metadata, and defend the whole thing in a QC review.

Course outline

# Lesson You will learn
1 Clinical study folder structure Repository layout, environments, naming, renv per study
2 Reading SAS7BDAT and XPT files haven, labels, formats, encoding, large files
3 SDTM programming in R Domain structure, --SEQ, ISO 8601, RELREC, SUPPQUAL
4 ADaM programming with admiral ADSL, BDS, OCCDS, derive_* functions, date imputation
5 Metadata-driven programming Specs as data, metacore, metatools, generated code
6 TLF generation Table structure, big-N, gtsummary, figures
7 r2rtf, Tplyr and related packages Production RTF, layered summaries, pagination
8 Validation and testing Double programming, diffdf, unit tests, QC evidence
9 Define.xml preparation Define-XML 2.1, datasetjson, value-level metadata
10 xportr Types, lengths, labels, formats, ordering, V5 constraints
11 Pharmaverse workflows The package ecosystem, admiralonco/admiralvaccine, templates
12 SAS-to-R migration Strategy, parallel running, validation, team transition

How to work through it

Lessons 1–2 are setup and can be skimmed if you already read SAS files in R routinely. Lessons 3–5 are the core derivation work. Lessons 6–7 produce the outputs. Lessons 8–10 are what makes it submittable — and are the ones most often underestimated. Lessons 11–12 are organisational.

ImportantAbout regulatory claims

This course teaches technique. Whether a specific approach is acceptable for a specific submission is a decision for your regulatory affairs and quality functions, informed by current health authority guidance. Where the course says “submissions have been made this way”, that is a statement about what has been done, not a guarantee about what will be accepted.

The R Consortium’s R Submissions Working Group maintains publicly documented pilot submissions to the FDA — they are the best reference for the current state of the art.

NotePackage versions

Examples assume admiral ≥ 1.1, xportr ≥ 0.4, r2rtf ≥ 1.1, Tplyr ≥ 1.2, metacore ≥ 0.1.3 and metatools ≥ 0.1.5. The pharmaverse moves quickly; where an interface has changed recently the lesson says so.

Start with Clinical study folder structure.

Back to top