TLF Generation

Pharma & Clinical

Generate the tables, listings, and figures (TLFs) that report a clinical trial — in R, from analysis-ready ADaM data. This hands-on series builds submission-grade outputs with the pharmaverse reporting stack (gtsummary, rtables, tern), starting from the demographic table that opens every clinical study report — each a complete, runnable build on public pharmaverse data.

LearnPharma & Clinical › TLF Generation

ADaM (the Analysis Data Model) makes the data analysis-ready; TLFs — tables, listings, and figures — are what a trial actually reports. This series generates submission-grade TLFs in R from ADaM datasets with the pharmaverse reporting stack: gtsummary for fast exploration, rtables and tern for the validated, RTF-able outputs that go into a clinical study report. Each lesson is a complete, runnable build on public pharmaverse data, so every number reproduces. The runtime is the judge.

The series builds the core TLFs every clinical study report carries:

  1. The demographic table (Table 1) — the baseline-characteristics table that opens the report. Build it two ways: the fast gtsummary path for exploration, and the submission-grade rtables/tern path for the validated output — the same numbers, different machinery, and when to reach for each.
  2. The efficacy (ANCOVA) table — the primary-endpoint result: an analysis of covariance of change from baseline that reports the adjusted (least-squares) mean per arm and the treatment-versus-reference difference, 95% CI, and p-value, built with tern’s summarize_ancova().
  3. The adverse-event summary table — the safety table at the heart of the report: treatment-emergent adverse events by system organ class and preferred term, by treatment arm, counting subjects (not events) against the safety population in rtables/tern.
  4. The Kaplan-Meier figure — the headline time-to-event figure: survival curves by arm with a number-at-risk table, medians, and the log-rank p, built in survminer from an ADTTE.
  5. The forest plot — the hazard-ratio figure that summarizes a Cox model and shows whether a treatment effect holds across subgroups: the per-covariate Cox-model forest with survminer’s ggforest(), and the subgroup forest built with ggplot2, from the same ADTTE.
  6. Patient listings → RTF — the row-per-observation appendix that lets a reviewer trace any number back to the individual records: build it with rlistings (key-column blanking, pagination) and export the submission RTF with r2rtf.
  7. ARD-first reporting — the modern, results-as-data workflow: build an Analysis Results Dataset (the CDISC Analysis Results Standard) with cards and cardx, so every number is a row you can table, plot, or re-use — then lay it out with gtsummary::tbl_ard_summary().

These build the TLF backbone of a submission; validation & QC — double programming and defensive checks — come next.

All lessons

No matching items
🟢 With an AI agent

Ask Prova “how do I build a submission-grade demographic table in rtables, and when should I reach for tern’s analyze_vars instead of gtsummary?” — it answers grounded in the CDISC reporting conventions and runnable rtables/tern code, so the table fits your study, not a generic example. The runtime is the judge. Ask Prova →

Was this page helpful?

Prove you can do it. Master the whole Clinical Programming in R (pharmaverse) series — track your path, build projects, and earn a certificate.

Start free →

Go Pro — unlimited Prova on your own data and a verifiable certificate that proves the skill.

from $15/mo billed yearly

Go Pro →

✓ You're Pro — keep going. The runtime is the judge.

Get new R & Python lessons by email

Practical, reproducible, no spam. Unsubscribe anytime.

Double opt-in. We never share your email.

Share this pageXLinkedInRedditHN

Citation

BibTeX citation:
@online{untitled,
  author = {},
  title = {TLF {Generation}},
  url = {https://www.datanovia.com/learn/pharma-clinical/04-tlf-generation/},
  langid = {en}
}
For attribution, please cite this work as:
“TLF Generation.” n.d. https://www.datanovia.com/learn/pharma-clinical/04-tlf-generation/.