Hands on with Cardinal: Harmonizing Clinical Reporting
Open-Source TLGs with {gtsummary}
Overview
Beginner Friendly Clinical Reporting TLGs
Cardinal is an open-source collection of standardized table, listing, and graph (TLG) templates designed to streamline the process of clinical output review, comparison, and meta-analysisโpromoting efficient communication to stakeholders while aligning with CDISCโs ARD/ARM efforts.
What Youโll Learn
- ๐ {gtsummary} fundamentals for table creation
- ๐ Cardinalโs TLG catalog and template library
- ๐ง Hands-on practice generating key clinical outputs
- ๐ค Contributing to the Cardinal project
- ๐ฏ Integration into your own workflows
Prerequisites
Required Knowledge:
- Basic R programming
- Familiarity with clinical trial data (CDISC preferred)
- No prior experience with {gtsummary} required
Recommended:
- Understanding of common TLG types
- Experience with clinical study reports
Key Packages & Tools
{gtsummary}
{cardinal}
{gt}
{cards}
CDISC ADaM
Why Cardinal?
The Problem
- ๐ Inconsistent formatting across studies and organizations
- โฑ๏ธ Time-consuming manual table creation
- ๐ Difficult to compare outputs across trials
- ๐ Repetitive coding for standard analyses
The Solution
Cardinal provides:
- โ Standardized templates for common TLGs
- โ Quality-controlled outputs aligned with CDISC
- โ Reusable code reducing development time
- โ Harmonized formats for meta-analysis
Introduction to {gtsummary}
{gtsummary} is the foundation for creating publication-ready tables:
library(gtsummary)
library(dplyr)
# Simple demographic table
trial %>%
select(age, grade, trt) %>%
tbl_summary(
by = trt,
statistic = list(
all_continuous() ~ "{mean} ({sd})",
all_categorical() ~ "{n} ({p}%)"
)
) %>%
add_p() %>%
add_overall()Key Features
- Intuitive syntax for common analyses
- Flexible customization options
- Built-in statistical tests
- Export to multiple formats (Word, HTML, LaTeX)
Cardinal TLG Catalog
Tables
1. Demographics and Baseline Characteristics
- Subject disposition
- Demographics (age, sex, race, ethnicity)
- Baseline disease characteristics
- Medical history
2. Efficacy Tables
- Primary/secondary endpoints
- Subgroup analyses
- Time-to-event summaries
- Response rates
3. Safety Tables
- Adverse events (by SOC, PT, severity)
- Laboratory values
- Vital signs
- Deaths and serious AEs
4. Disposition Tables
- Study completion
- Protocol deviations
- Exposure duration
Listings
- Patient profiles
- Adverse event listings
- Laboratory abnormalities
- Concomitant medications
Graphs
- Kaplan-Meier survival curves
- Forest plots (subgroup analysis)
- Swimmer plots (treatment duration)
- Waterfall plots (tumor response)
Workshop Content
Session 1: Getting Started with {gtsummary}
Basic Table Creation:
library(gtsummary)
library(cardinal)
# Load example CDISC data
data("adsl", package = "cardinal")
# Demographic table
demo_table <- adsl %>%
select(AGE, SEX, RACE, ARM) %>%
tbl_summary(
by = ARM,
label = list(
AGE ~ "Age (years)",
SEX ~ "Sex",
RACE ~ "Race"
)
) %>%
add_p() %>%
add_overall() %>%
modify_header(label ~ "**Characteristic**") %>%
bold_labels()Session 2: Cardinal Templates
Using Pre-built Templates:
# Cardinal provides ready-to-use templates
template_demographics(
data = adsl,
treatment_var = "ARM"
)
template_ae_summary(
data = adae,
treatment_var = "ARM",
ae_vars = c("AESOC", "AEDECOD")
)Session 3: Customization
Adapting Templates to Your Needs:
- Modifying statistical summaries
- Custom formatting rules
- Adding footnotes and titles
- Styling for different audiences (clinical vs. regulatory)
Session 4: Advanced Topics
Complex Tables:
- Multi-level headers
- Nested statistics
- Cross-tabulations
- Survival analysis tables
Session 5: Contributing to Cardinal
How to Get Involved:
- Submit new template ideas
- Contribute code improvements
- Report issues and bugs
- Share use cases and examples
Hands-On Exercises
Exercise 1: Basic Demographics Table
Create a standard demographics table using your own data or provided examples.
Exercise 2: Adverse Events Summary
Generate a treatment-emergent adverse events (TEAE) table by system organ class.
Exercise 3: Efficacy Analysis
Build a primary endpoint analysis table with statistical comparisons.
Exercise 4: Custom Template
Modify an existing Cardinal template to match your organizationโs standards.
Practical Applications
Clinical Study Reports (CSRs)
- Consistent formatting across studies
- Rapid generation of standard tables
- Easy updates during review cycles
Meta-Analysis
- Harmonized outputs from multiple trials
- Simplified data extraction
- Comparable statistics across studies
Regulatory Submissions
- CDISC-aligned outputs
- Traceable and reproducible code
- Audit-ready documentation
Cardinal vs. Other Approaches
| Feature | Cardinal + {gtsummary} | Traditional Approach | Other Tools |
|---|---|---|---|
| Standardization | โ High | โ Low | โ ๏ธ Medium |
| Learning Curve | โ Gentle | โ Steep | โ ๏ธ Moderate |
| Flexibility | โ High | โ High | โ Limited |
| Open Source | โ Yes | โ ๏ธ Varies | โ Often proprietary |
| CDISC Alignment | โ Built-in | โ Manual | โ ๏ธ Varies |
| Cost | โ Free | โ ๏ธ Varies | โ Often expensive |
ARD/ARM Integration
Cardinal aligns with CDISC Analysis Results Data (ARD) and Analysis Results Metadata (ARM) standards:
- Structured output metadata
- Machine-readable results
- Facilitates automation
- Supports regulatory review
Learning Outcomes
By the end of this workshop, you will be able to:
โ
Create professional clinical tables with {gtsummary}
โ
Use Cardinal templates for standard TLGs
โ
Customize outputs to match your organizationโs needs
โ
Generate CDISC-aligned, reproducible tables
โ
Contribute to the Cardinal project
โ
Accelerate your clinical reporting workflows
Workshop Materials
Cardinal Website: https://pharmaverse.github.io/cardinal/
GitHub: https://github.com/pharmaverse/cardinal
{gtsummary} Documentation: https://www.danieldsjoberg.com/gtsummary/
Example: Complete Workflow
library(cardinal)
library(gtsummary)
library(gt)
# 1. Load data
data("adsl")
data("adae")
# 2. Create demographics table
demo <- template_demographics(adsl, treatment_var = "ARM")
# 3. Create AE summary
ae_summary <- template_ae_summary(
adae,
treatment_var = "ARM",
soc_var = "AESOC",
pt_var = "AEDECOD"
)
# 4. Export to Word
demo %>%
as_gt() %>%
gt::gtsave("demographics.docx")
ae_summary %>%
as_gt() %>%
gt::gtsave("adverse_events.docx")Future of Cardinal
Roadmap:
- Expanded template library
- More graph types
- Enhanced CDISC integration
- Integration with {teal} and other pharmaverse tools
- Machine learning-assisted table suggestions
Getting Help
- Documentation: Comprehensive guides on the website
- GitHub Issues: Report bugs and request features
- Slack: pharmaverse Slack channel
- Email: Contact maintainers directly
Next Steps
After this workshop:
- Explore the full Cardinal template catalog
- Try Cardinal in your next project
- Join the pharmaverse community
- Consider contributing a template
- Start with templates - Donโt reinvent the wheel
- Customize gradually - Master basics before advanced features
- Document your modifications - Make it reproducible
- Share back - Your improvements can help others
- Stay updated - Cardinal is actively developed
Similar Workshops
- Advanced Clinical Reporting - Word documents with officer/flextable
- Polished Documents with Quarto - Multi-format publishing
Tools & Resources
- {gtsummary} - Most mentioned package
- {cardinal} - Full catalog entry
Next Steps
- For Word output: Try officer/flextable workshop
- Career skills: Clinical Reporting Automation
Last updated: November 2025 | R/Pharma 2025 Conference