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
)
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 withNA
orNaN
values are removed from all calculations.- .overall
(
logical
)
logical indicating whether overall statistics should be calculated (i.e. re-run allard_*()
calls withby=NULL
). Default isFALSE
.- .missing
(
logical
)
logical indicating whether to include the results ofard_missing()
for all variables represented in the ARD. Default isFALSE
.- .attributes
(
logical
)
logical indicating whether to include the results ofard_attributes()
for all variables represented in the ARD. Default isFALSE
.- .total_n
(
logical
)
logical indicating whether to include ofard_total_n()
in the returned ARD.- .shuffle
(
logical
)
logical indicating whether to performshuffle_ard()
on the final result. Default isFALSE
.
Examples
ard_stack(
data = ADSL,
ard_categorical(variables = "AGEGR1"),
ard_continuous(variables = "AGE"),
.by = "ARM",
.overall = TRUE,
.attributes = TRUE
)
#> {cards} data frame: 83 x 11
#> group1 group1_level variable variable_level stat_name stat_label stat
#> 1 ARM Placebo AGEGR1 65-80 n n 42
#> 2 ARM Placebo AGEGR1 65-80 N N 86
#> 3 ARM Placebo AGEGR1 65-80 p % 0.488
#> 4 ARM Placebo AGEGR1 <65 n n 14
#> 5 ARM Placebo AGEGR1 <65 N N 86
#> 6 ARM Placebo AGEGR1 <65 p % 0.163
#> 7 ARM Placebo AGEGR1 >80 n n 30
#> 8 ARM Placebo AGEGR1 >80 N N 86
#> 9 ARM Placebo AGEGR1 >80 p % 0.349
#> 10 ARM Xanomeli… AGEGR1 65-80 n n 55
#> ℹ 73 more rows
#> ℹ Use `print(n = ...)` to see more rows
#> ℹ 4 more variables: context, fmt_fn, warning, error
ard_stack(
data = ADSL,
ard_categorical(variables = "AGEGR1"),
ard_continuous(variables = "AGE"),
.by = "ARM",
.shuffle = TRUE
)
#> # A tibble: 60 × 6
#> ARM variable label context stat_name stat
#> <chr> <chr> <chr> <chr> <chr> <dbl>
#> 1 Placebo AGEGR1 65-80 categorical n 42
#> 2 Placebo AGEGR1 65-80 categorical N 86
#> 3 Placebo AGEGR1 65-80 categorical p 0.488
#> 4 Placebo AGEGR1 <65 categorical n 14
#> 5 Placebo AGEGR1 <65 categorical N 86
#> 6 Placebo AGEGR1 <65 categorical p 0.163
#> 7 Placebo AGEGR1 >80 categorical n 30
#> 8 Placebo AGEGR1 >80 categorical N 86
#> 9 Placebo AGEGR1 >80 categorical p 0.349
#> 10 Xanomeline High Dose AGEGR1 65-80 categorical n 55
#> # ℹ 50 more rows