ard_continuous {cards} | R Documentation |
Continuous ARD Statistics
Description
Compute Analysis Results Data (ARD) for simple continuous summary statistics.
Usage
ard_continuous(data, ...)
## S3 method for class 'data.frame'
ard_continuous(
data,
variables,
by = dplyr::group_vars(data),
strata = NULL,
statistic = everything() ~ continuous_summary_fns(),
fmt_fn = NULL,
stat_label = everything() ~ default_stat_labels(),
...
)
Arguments
data |
(data.frame )
a data frame
|
... |
Arguments passed to methods.
|
variables |
(tidy-select )
columns to include in summaries. Default is everything() .
|
by , strata |
(tidy-select )
columns to tabulate by/stratify by for summary statistic
calculation. Arguments are similar, but with an important distinction:
by : results are calculated for all combinations of the columns specified,
including unobserved combinations and unobserved factor levels.
strata : results are calculated for all observed combinations of the
columns specified.
Arguments may be used in conjunction with one another.
|
statistic |
(formula-list-selector )
a named list, a list of formulas,
or a single formula where the list element is a named list of functions
(or the RHS of a formula),
e.g. list(mpg = list(mean = \(x) mean(x))) .
The value assigned to each variable must also be a named list, where the names
are used to reference a function and the element is the function object.
Typically, this function will return a scalar statistic, but a function that
returns a named list of results is also acceptable, e.g.
list(conf.low = -1, conf.high = 1) . However, when errors occur, the messaging
will be less clear in this setting.
|
fmt_fn |
(formula-list-selector )
a named list, a list of formulas,
or a single formula where the list element is a named list of functions
(or the RHS of a formula),
e.g. list(mpg = list(mean = \(x) round(x, digits = 2) |> as.character())) .
|
stat_label |
(formula-list-selector )
a named list, a list of formulas, or a single formula where
the list element is either a named list or a list of formulas defining the
statistic labels, e.g. everything() ~ list(mean = "Mean", sd = "SD") or
everything() ~ list(mean ~ "Mean", sd ~ "SD") .
|
Value
an ARD data frame of class 'card'
Examples
ard_continuous(ADSL, by = "ARM", variables = "AGE")
# if a single function returns a named list, the named
# results will be placed in the resulting ARD
ADSL |>
dplyr::group_by(ARM) |>
ard_continuous(
variables = "AGE",
statistic =
~ list(conf.int = \(x) t.test(x)[["conf.int"]] |>
as.list() |>
setNames(c("conf.low", "conf.high")))
)
[Package
cards version 0.2.2
Index]