Skip to content

insightsengineering/cards

Repository files navigation

cards cards website

CRAN status Codecov test coverage Downloads R-CMD-check Lifecycle: experimental

The CDISC Analysis Results Standard aims to facilitate automation, reproducibility, reusability, and traceability of analysis results data (ARD). The {cards} package creates these CDISC Analysis Result Data Sets.

Use cases:

  1. Quality Control (QC) of existing tables and figures.

  2. Pre-calculate statistics to be summarized in tables and figures.

  3. Medical writers may easily access statistics and place in reports without copying and pasting from reports.

  4. Provides a consistent format for results and lends results to be combined across studies for re-use and re-analysis.

Installation

Install cards from CRAN with:

install.packages("cards")

You can install the development version of cards from GitHub with:

# install.packages("devtools")
devtools::install_github("insightsengineering/cards")

Extensions

cardx website

The {cards} package exports three types of functions:

  1. Functions to create basic ARD objects.

  2. Utilities to create new ARD objects.

  3. Functions to work with existing ARD objects.

The {cardx} R package is an extension to {cards} that uses the utilities from {cards} and exports functions for creating additional ARD objects––including functions to summarize t-tests, Wilcoxon Rank-Sum tests, regression models, and more.

Getting Started

Review the Getting Started page for examples using ARDs to calculate statistics to later include in tables.

library(cards)

ard_continuous(ADSL, by = "ARM", variables = "AGE")
#> {cards} data frame: 24 x 10
#>    group1 group1_level variable stat_name stat_label   stat
#> 1     ARM      Placebo      AGE         N          N     86
#> 2     ARM      Placebo      AGE      mean       Mean 75.209
#> 3     ARM      Placebo      AGE        sd         SD   8.59
#> 4     ARM      Placebo      AGE    median     Median     76
#> 5     ARM      Placebo      AGE       p25         Q1     69
#> 6     ARM      Placebo      AGE       p75         Q3     82
#> 7     ARM      Placebo      AGE       min        Min     52
#> 8     ARM      Placebo      AGE       max        Max     89
#> 9     ARM    Xanomeli…      AGE         N          N     84
#> 10    ARM    Xanomeli…      AGE      mean       Mean 74.381
#> ℹ 14 more rows
#> ℹ Use `print(n = ...)` to see more rows
#> ℹ 4 more variables: context, fmt_fn, warning, error

Other Resources

<style>#pjwdrvnjxr table { font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #pjwdrvnjxr thead, #pjwdrvnjxr tbody, #pjwdrvnjxr tfoot, #pjwdrvnjxr tr, #pjwdrvnjxr td, #pjwdrvnjxr th { border-style: none; } #pjwdrvnjxr p { margin: 0; padding: 0; } #pjwdrvnjxr .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 16px; font-weight: normal; font-style: normal; background-color: #FFFFFF; width: auto; border-top-style: solid; border-top-width: 2px; border-top-color: #A8A8A8; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #pjwdrvnjxr .gt_caption { padding-top: 4px; padding-bottom: 4px; } #pjwdrvnjxr .gt_title { color: #333333; font-size: 125%; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #pjwdrvnjxr .gt_subtitle { color: #333333; font-size: 85%; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #pjwdrvnjxr .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #pjwdrvnjxr .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #pjwdrvnjxr .gt_col_headings { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #pjwdrvnjxr .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #pjwdrvnjxr .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #pjwdrvnjxr .gt_column_spanner_outer:first-child { padding-left: 0; } #pjwdrvnjxr .gt_column_spanner_outer:last-child { padding-right: 0; } #pjwdrvnjxr .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #pjwdrvnjxr .gt_spanner_row { border-bottom-style: hidden; } #pjwdrvnjxr .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #pjwdrvnjxr .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #pjwdrvnjxr .gt_from_md > :first-child { margin-top: 0; } #pjwdrvnjxr .gt_from_md > :last-child { margin-bottom: 0; } #pjwdrvnjxr .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: solid; border-top-width: 1px; border-top-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #pjwdrvnjxr .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #pjwdrvnjxr .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: solid; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #pjwdrvnjxr .gt_row_group_first td { border-top-width: 2px; } #pjwdrvnjxr .gt_row_group_first th { border-top-width: 2px; } #pjwdrvnjxr .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #pjwdrvnjxr .gt_first_summary_row { border-top-style: solid; border-top-color: #D3D3D3; } #pjwdrvnjxr .gt_first_summary_row.thick { border-top-width: 2px; } #pjwdrvnjxr .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #pjwdrvnjxr .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #pjwdrvnjxr .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: double; border-top-width: 6px; border-top-color: #D3D3D3; } #pjwdrvnjxr .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: double; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #pjwdrvnjxr .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #pjwdrvnjxr .gt_table_body { border-top-style: solid; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #pjwdrvnjxr .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #pjwdrvnjxr .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #pjwdrvnjxr .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #pjwdrvnjxr .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #pjwdrvnjxr .gt_left { text-align: left; } #pjwdrvnjxr .gt_center { text-align: center; } #pjwdrvnjxr .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #pjwdrvnjxr .gt_font_normal { font-weight: normal; } #pjwdrvnjxr .gt_font_bold { font-weight: bold; } #pjwdrvnjxr .gt_font_italic { font-style: italic; } #pjwdrvnjxr .gt_super { font-size: 65%; } #pjwdrvnjxr .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #pjwdrvnjxr .gt_asterisk { font-size: 100%; vertical-align: 0; } #pjwdrvnjxr .gt_indent_1 { text-indent: 5px; } #pjwdrvnjxr .gt_indent_2 { text-indent: 10px; } #pjwdrvnjxr .gt_indent_3 { text-indent: 15px; } #pjwdrvnjxr .gt_indent_4 { text-indent: 20px; } #pjwdrvnjxr .gt_indent_5 { text-indent: 25px; } #pjwdrvnjxr .katex-display { display: inline-flex !important; margin-bottom: 0.75em !important; } #pjwdrvnjxr div.Reactable > div.rt-table > div.rt-thead > div.rt-tr.rt-tr-group-header > div.rt-th-group:after { height: 0px !important; } </style>
2025 PHUSE US Connect Analysis Results Datasets Using Open-Source Tools from the {pharmaverse}
2024 R/Pharma Harnessing CDISC’s Emerging Analysis Results Datasets Standard
2024 R/Pharma Workshop: Unlocking Analysis Results Datasets
posit::conf(2024) {pharmaverse} workshop
2024 China Pharma R User Conference Keynote Address