General function for calculating ARD results within subgroups.
While the examples below show use with other functions from the cards package, this function would primarily be used with the statistical functions in the cardx functions.
Arguments
- .data
(
data.frame
)
a data frame- .by, .strata
-
(
tidy-select
)
columns to tabulate by/stratify by for calculation. Arguments are similar, but with an important distinction:.by
: results are tabulated by all combinations of the columns specified, including unobserved combinations and unobserved factor levels..strata
: results are tabulated by all observed combinations of the columns specified.These argument should not include any columns that appear in the
.f
argument. - .f
(
function
,formula
)
a function or a formula that can be coerced to a function withrlang::as_function()
(similar topurrr::map(.f)
)- ...
Additional arguments passed on to the
.f
function.
Examples
ard_strata(
ADSL,
.by = ARM,
.f = ~ ard_continuous(.x, 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