Learn R Programming

cards (version 0.7.0)

ard_stack: Stack ARDs

Description

Stack multiple ARD calls sharing common input data and by variables. Optionally incorporate additional information on represented variables, e.g. overall calculations, rates of missingness, attributes, or transform results with shuffle_ard().

If the ard_stack(by) argument is specified, a univariate tabulation of the by variable will also be returned.

Usage

ard_stack(
  data,
  ...,
  .by = NULL,
  .overall = FALSE,
  .missing = FALSE,
  .attributes = FALSE,
  .total_n = FALSE,
  .shuffle = FALSE,
  .by_stats = TRUE
)

Value

an ARD data frame of class 'card'

Arguments

data

(data.frame)
a data frame

...

(dynamic-dots)
Series of ARD function calls to be run and stacked

.by

(tidy-select)
columns to tabulate by in the series of ARD function calls. Any rows with NA or NaN values are removed from all calculations.

.overall

(logical)
logical indicating whether overall statistics should be calculated (i.e. re-run all ard_*() calls with by=NULL). Default is FALSE.

.missing

(logical)
logical indicating whether to include the results of ard_missing() for all variables represented in the ARD. Default is FALSE.

.attributes

(logical)
logical indicating whether to include the results of ard_attributes() for all variables represented in the ARD. Default is FALSE.

.total_n

(logical)
logical indicating whether to include of ard_total_n() in the returned ARD.

.shuffle

[Deprecated] support for .shuffle = TRUE will be removed in the next release. ard_stack() will no longer shuffle. shuffle_ard() should be called separately.

.by_stats

(logical)
logical indicating whether to include overall stats of the by variables in the returned ARD.

Examples

Run this code
ard_stack(
  data = ADSL,
  ard_tabulate(variables = "AGEGR1"),
  ard_summary(variables = "AGE"),
  .by = "ARM",
  .overall = TRUE,
  .attributes = TRUE
)

ard_stack(
  data = ADSL,
  ard_tabulate(variables = "AGEGR1"),
  ard_summary(variables = "AGE"),
  .by = "ARM",
  .shuffle = TRUE
)

Run the code above in your browser using DataLab