| Type: | Package |
| Title: | FDA Safety Tables and Figures |
| Version: | 0.3.0 |
| Date: | 2026-09-04 |
| Description: | Provides implementations of safety tables and figures recommended by the FDA (U.S. Food and Drug Administration) for clinical trial reporting. Functions generate standard outputs for adverse events, laboratory abnormalities, vital signs, exposure, and other safety domains following the FDA's Safety Reporting guidelines. Outputs are built on the 'gtsummary', 'cards', and 'cardx' frameworks, enabling reproducible and submission-ready clinical trial safety summaries. |
| License: | Apache License (≥ 2) |
| URL: | https://github.com/pharmaverse/cardinal/, https://pharmaverse.github.io/cardinal/ |
| BugReports: | https://github.com/pharmaverse/cardinal/issues |
| Depends: | cards (≥ 0.8.1), cardx (≥ 0.3.4), crane (≥ 0.3.1), gtsummary (≥ 2.5.1), R (≥ 4.2) |
| Imports: | dplyr (≥ 1.2.0) |
| Suggests: | cowplot (≥ 1.2.0), forcats (≥ 1.0.1), ggplot2 (≥ 4.0), ggsurvfit (≥ 1.2.0), gt (≥ 1.3.0), knitr (≥ 1.50), labelled (≥ 2.16.0), lubridate (≥ 1.9), pharmaverseadam (≥ 1.3.0), purrr (≥ 1.2), random.cdisc.data (≥ 0.3.16), rlang (≥ 1.1.7), rtables (≥ 0.6.11), svglite (≥ 2.2.2), tern (≥ 0.9.8), testthat (≥ 3.3.1), tidyr (≥ 1.3.1), withr (≥ 3.0.2) |
| Config/roxygen2/version: | 8.1.0 |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| Language: | en-US |
| NeedsCompilation: | no |
| Packaged: | 2026-09-04 16:03:33 UTC; zhus31 |
| Author: | Pawel Rucki [ctb],
Abinaya Yogasekaram
|
| Maintainer: | Joe Zhu <joe.zhu@roche.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-04 16:30:08 UTC |
cardinalfda
Description
Implementation of FDA Safety Tables and Figures
Author(s)
Maintainer: Joe Zhu joe.zhu@roche.com (ORCID)
Authors:
Abinaya Yogasekaram ayogasek@gmail.com (ORCID)
Emily de la Rua emilydelarua@gmail.com (ORCID)
Davide Garolini davide.garolini@roche.com (ORCID)
Vincent Shen
Other contributors:
Pawel Rucki pawel.rucki@roche.com [contributor]
Daniel D. Sjoberg danield.sjoberg@gmail.com (ORCID) [contributor]
Benoit Falquet benoit.falquet@roche.com (ORCID) [contributor]
Lluís Revilla Sancho lluis.revilla_sancho@roche.com (ORCID) [contributor]
Huan Lu huan.lu@sanofi.com [contributor]
Alex Assuied [contributor]
Yoshito Koujin [contributor]
Korbinian Matthias [contributor]
Jessica Knizia [contributor]
Freeman Wang [contributor]
See Also
Useful links:
Report bugs at https://github.com/pharmaverse/cardinal/issues
Pre-Process alt_counts_df for Safety Population
Description
If alt_counts_df is not NULL, will check for required variables (arm_var) and filter
to include only safety population (saffl_var, if specified), then apply tern::df_explicit_na().
Usage
alt_counts_df_preproc(
alt_counts_df,
id_var = "USUBJID",
arm_var = "ARM",
saffl_var = NULL
)
Arguments
alt_counts_df |
( |
id_var |
( |
arm_var |
( |
saffl_var |
( |
Value
A data.frame (modified alt_counts_df) or NULL.
Standard Arguments
Description
This documentation lists all the arguments in cardinalfda that are used repeatedly by functions to output tables.
Arguments
show_colcounts |
( |
arm_var |
( |
id_var |
( |
saffl_var |
( |
ser_var |
( |
lbl_overall |
( |
vars |
( |
lbl_vars |
( |
pref_var |
( |
soc_var |
( |
lbl_pref_var |
( |
lbl_soc_var |
( |
.stats |
( |
.formats |
(named |
na_rm |
( |
prune_0 |
( |
na_level |
( |
adae |
( |
adex |
( |
advs |
( |
adsl |
( |
alt_counts_df |
( |
annotations |
(named |
ard |
( |
denominator |
( |
df |
( |
eosdy_var |
( |
fmqsc_var |
( |
fmqnam_var |
( |
fmq_scope |
( |
ggtheme |
( |
return_ard |
( |
risk_diff |
(named
|
sex_scope |
( |
table_engine |
( |
trtedtm_var |
( |
trtemfl_var |
( |
trtsdtm_var |
( |
u_trtdur |
( |
xticks |
( |
x_lab |
( |
yticks |
( |
y_lab |
( |
Check Values of Flag Variables
Description
Flag variables are expected to take one of two values: "Y" (yes/true) or
"N" (no/false). Missing values are also accepted and treated as "N".
Usage
assert_flag_variables(df, flag_vars, na_level = "<Missing>")
Arguments
df |
( |
flag_vars |
( |
na_level |
( |
Value
Invisibly returns TRUE if all flag variables are valid; otherwise stops with an error.
Initialize Table Layout with Annotations
Description
Initializes a table layout via rtables::basic_table() and applies show_colcounts
argument. Adds any annotations supplied via the annotations argument.
Usage
basic_table_annot(show_colcounts = TRUE, annotations = NULL)
Arguments
show_colcounts |
( |
annotations |
(named |
Value
An rtables PreDataTableLayouts object suitable for passing to further layout functions, and
to build_table.
Run a Table or Figure Template Script
Description
Source one of the self-contained template scripts shipped in
inst/templates and return the object it builds. Each template is a plain
R script that produces a tbl object (and, where relevant, an ard),
so the same script can be run here for testing, copied into the catalog,
or handed to a user as a starting point.
Keeping the full script as the single source of truth avoids drifting between what is tested and what is published in the catalog.
Usage
run_template(name, envir = new.env(parent = parent.frame()))
Arguments
name |
( |
envir |
( |
Value
the environment the template was evaluated in, invisibly. Template
objects (such as tbl and ard) are available as bindings in it.
Examples
## Not run:
env <- run_template("fda-table_07")
env$tbl
## End(Not run)
Split Columns by Arm Variable
Description
Splits rtables layout into columns by arm variable. Appends an "overall" column as the
rightmost column if lbl_overall is supplied.
Usage
split_cols_by_arm(lyt, arm_var = "ARM", lbl_overall = NULL, risk_diff = NULL)
Arguments
lyt |
( |
arm_var |
( |
lbl_overall |
( |
risk_diff |
(named
|
Value
An rtables PreDataTableLayouts object suitable for passing to further layout functions, and
to build_table.