df: The variables specified by id_var, arm_var, saffl_var, and soc_var.
denominator (if specified): USUBJID and the variables specified by arm_var and saffl_var
If both the ARD (return_ard = TRUE) and an overall column (lbl_overall not missing) are requested, a list of two ARDs will be returned: one for the table by groups, and the other for the overall column.
Argument
Description
Default
df
(data.frame) Dataset (typically ADSL) required to build table.
No default
return_ard
(flag) Whether an ARD should be returned.
TRUE
denominator
(character) Alternative dataset used only to calculate column counts.
NULL
id_var
(character) Identifier variable used to count the participants within each flag.
"USUBJID"
arm_var
(character) Arm variable used to split table into columns.
"ARM"
saffl_var
(character) Flag variable used to indicate inclusion in safety population.
"SAFFL"
soc_var
(character) SOC variable from adae to include in the table.
"ARBODSYS"
na_level
(character) String to represent missing values.
"<Missing>"
lbl_overall
(character) String to represent the label of an overall column.
group1 group1_level variable variable_level context stat_name stat_label stat stat_fmt fmt_fn warning error gts_column
1 ARM A: Drug X AEBODSYS cl A.1 hierarch… n n 78 78 <fn> stat_1
2 ARM A: Drug X AEBODSYS cl A.1 hierarch… N N 134 134 <fn> stat_1
3 ARM A: Drug X AEBODSYS cl A.1 hierarch… p % 0.582 58 <fn> stat_1
4 ARM A: Drug X AEBODSYS cl B.1 hierarch… n n 47 47 <fn> stat_1
5 ARM A: Drug X AEBODSYS cl B.1 hierarch… N N 134 134 <fn> stat_1
6 ARM A: Drug X AEBODSYS cl B.1 hierarch… p % 0.351 35 <fn> stat_1
7 ARM A: Drug X AEBODSYS cl B.2 hierarch… n n 79 79 <fn> stat_1
8 ARM A: Drug X AEBODSYS cl B.2 hierarch… N N 134 134 <fn> stat_1
9 ARM A: Drug X AEBODSYS cl B.2 hierarch… p % 0.59 59 <fn> stat_1
10 ARM A: Drug X AEBODSYS cl C.1 hierarch… n n 43 43 <fn> stat_1
df: USUBJID and the variables specified by arm_var, saffl_var and soc_var.
alt_counts_df (if specified): USUBJID and the variables specified by arm_var and saffl_var.
Argument
Description
Default
df
(data.frame) Dataset (typically ADAE) required to build table.
No default
alt_counts_df
(character) Alternative dataset (typically ADSL) used only to calculate column counts.
NULL
show_colcounts
(flag) Whether column counts should be printed.
TRUE
id_var
(character) Subject identifier variable .
USUBJID
arm_var
(character) Arm variable used to split table into columns.
"ARM"
saffl_var
(character) Flag variable used to indicate inclusion in safety population.
"SAFFL"
soc_var
(character) SOC variable from adae to include in the table.
"AEDECOD"
lbl_soc_var
(character) Label corresponding to SOC variable soc_var to print in the table.
formatters::var_labels(adae, fill = TRUE)[soc_var]
lbl_overall
(character) If specified, an overall column will be added to the table with the given value as the column label.
NULL
risk_diff
(named list) List of settings to apply to add a risk difference column to the table. See tern::add_riskdiff() for more details. List should contain the following elements:
arm_x: (required) the name of reference arm.
arm_y: (required) the name of the arm to compare to the reference arm.
col_label: (optional) label to use for the risk difference column. Defaults to "Risk Difference (%) (95% CI)".
pct: (optional) whether the output should be returned as percentages. Defaults to TRUE.
NULL
prune_0
(flag) Whether all-zero rows should be removed from the table.
FALSE
annotations
(named list of character) List of annotations to add to the table. Valid annotation types are title, subtitles, main_footer, and prov_footer. Each name-value pair should use the annotation type as name and the desired string as value.
---title: FDA Table 35subtitle: Patients With Adverse Events by System Organ Class, Safety Population, Pooled Analysis (or Trial X)---```{r setup, echo=FALSE}```::: panel-tabset## Spec. Screenshot{fig-align="center" width="70%"}## gtsummary Table<details><summary>gtsummary Table Setup</summary>```{r tbl1, eval=FALSE, echo=TRUE}# Load Libraries & Datalibrary(cardinal)adsl <- random.cdisc.data::cadsladae <- random.cdisc.data::cadae# Output Tablemake_table_35(df = adae, denominator = adsl, return_ard = FALSE)```</details><details><summary>Function Details</summary>### `make_table_35()`------------------------------------------------------------------------Required variables:- **`df`**: The variables specified by `id_var`, `arm_var`, `saffl_var`, and `soc_var`.- **`denominator`** (if specified): `USUBJID` and the variables specified by `arm_var` and `saffl_var`- If both the ARD (`return_ard = TRUE`) and an overall column (`lbl_overall` not missing) are requested, a list of two ARDs will be returned: one for the table by groups, and the other for the overall column.+---------------+------------------------------------------------------------------------------------+---------------+| **Argument** | **Description** | **Default** |+---------------+------------------------------------------------------------------------------------+---------------+| `df` | (`data.frame`) Dataset (typically ADSL) required to build table. | *No default* |+---------------+------------------------------------------------------------------------------------+---------------+| `return_ard` | (`flag`) Whether an ARD should be returned. | `TRUE` |+---------------+------------------------------------------------------------------------------------+---------------+| `denominator` | (`character`) Alternative dataset used only to calculate column counts. | `NULL` |+---------------+------------------------------------------------------------------------------------+---------------+| `id_var` | (`character`) Identifier variable used to count the participants within each flag. | `"USUBJID"` |+---------------+------------------------------------------------------------------------------------+---------------+| `arm_var` | (`character`) Arm variable used to split table into columns. | `"ARM"` |+---------------+------------------------------------------------------------------------------------+---------------+| `saffl_var` | (`character`) Flag variable used to indicate inclusion in safety population. | `"SAFFL"` |+---------------+------------------------------------------------------------------------------------+---------------+| `soc_var` | (`character`) SOC variable from `adae` to include in the table. | `"ARBODSYS"` |+---------------+------------------------------------------------------------------------------------+---------------+| `na_level` | (`character`) String to represent missing values. | `"<Missing>"` |+---------------+------------------------------------------------------------------------------------+---------------+| `lbl_overall` | (`character`) String to represent the label of an overall column. | `NULL` |+---------------+------------------------------------------------------------------------------------+---------------+Source code for this function is available [here](https://github.com/pharmaverse/cardinal/blob/main/R/fda-table_35.R).</details>## ARD<details><summary>ARD Setup</summary>```{r tbl2, echo=TRUE, message=FALSE, warning=FALSE, results='hide'}# Load Libraries & Datalibrary(cardinal)adsl <- random.cdisc.data::cadsladae <- random.cdisc.data::cadae# Create Table and ARDresult <- make_table_35(df = adae, denominator = adsl)# Output ARDresult$ard``````{r tbl2-print, echo=FALSE}withr::local_options(width = 9999)print(result$ard, columns = "all")```</details>## rtables Table<details><summary>rtables Table Setup</summary>```{r tbl3, eval=FALSE, echo=TRUE}# Load Libraries & Datalibrary(random.cdisc.data)library(cardinal)adsl <- random.cdisc.data::cadsladae <- random.cdisc.data::cadae# Output Tablerisk_diff <- list(arm_x = "B: Placebo", arm_y = "A: Drug X") # optionalmake_table_35_rtables(df = adae, alt_counts_df = adsl, risk_diff = risk_diff)```</details>```{r tbl3, message=FALSE, warning=FALSE, eval=TRUE}```<details><summary>Function Details</summary>### `make_table_35_rtables()`------------------------------------------------------------------------Required variables:- **`df`**: `USUBJID` and the variables specified by `arm_var`, `saffl_var` and `soc_var`.- **`alt_counts_df`** (if specified): `USUBJID` and the variables specified by `arm_var` and `saffl_var`.+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| **Argument** | **Description** | **Default** |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `df` | (`data.frame`) Dataset (typically ADAE) required to build table. | *No default* |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `alt_counts_df` | (`character`) Alternative dataset (typically ADSL) used only to calculate column counts. | `NULL` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `show_colcounts` | (`flag`) Whether column counts should be printed. | `TRUE` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `id_var` | (`character`) Subject identifier variable . | `USUBJID` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `arm_var` | (`character`) Arm variable used to split table into columns. | `"ARM"` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `saffl_var` | (`character`) Flag variable used to indicate inclusion in safety population. | `"SAFFL"` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `soc_var` | (`character`) SOC variable from `adae` to include in the table. | `"AEDECOD"` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `lbl_soc_var` | (`character`) Label corresponding to SOC variable `soc_var` to print in the table. | `formatters::var_labels(adae, fill = TRUE)[soc_var]` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `lbl_overall` | (`character`) If specified, an overall column will be added to the table with the given value as the column label. | `NULL` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `risk_diff` | (named `list`) List of settings to apply to add a risk difference column to the table. See [`tern::add_riskdiff()`](https://insightsengineering.github.io/tern/main/reference/add_riskdiff.html) for more details. List should contain the following elements: | `NULL` || | | || | - `arm_x`: (required) the name of reference arm. | || | | || | - `arm_y`: (required) the name of the arm to compare to the reference arm. | || | | || | - `col_label`: (optional) label to use for the risk difference column. Defaults to `"Risk Difference (%) (95% CI)"`. | || | | || | - `pct`: (optional) whether the output should be returned as percentages. Defaults to `TRUE`. | |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `prune_0` | (`flag`) Whether all-zero rows should be removed from the table. | `FALSE` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+| `annotations` | (named `list` of `character`) List of annotations to add to the table. Valid annotation types are `title`, `subtitles`, `main_footer`, and `prov_footer.` Each name-value pair should use the annotation type as name and the desired string as value. | `NULL` |+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------+Source code for this function is available [here](https://github.com/pharmaverse/cardinal/blob/main/R/fda-table_35.R).</details>:::