ard_complex | R Documentation |
Function is similar to ard_continuous()
, but allows for more complex
summaries. While ard_continuous(statistic)
only allows for a univariable
function, ard_complex(statistic)
can handle more complex data summaries.
ard_complex(data, ...)
## S3 method for class 'data.frame'
ard_complex(
data,
variables,
by = dplyr::group_vars(data),
strata = NULL,
statistic,
fmt_fn = NULL,
stat_label = everything() ~ default_stat_labels(),
...
)
data |
( |
... |
Arguments passed to methods. |
variables |
( |
by , strata |
(
Arguments may be used in conjunction with one another. |
statistic |
(
|
fmt_fn |
( |
stat_label |
( |
an ARD data frame of class 'card'
# example how to mimic behavior of `ard_continuous()`
ard_complex(
ADSL,
by = "ARM",
variables = "AGE",
statistic = list(AGE = list(mean = \(x, ...) mean(x)))
)
# return the grand mean and the mean within the `by` group
grand_mean <- function(data, full_data, variable, ...) {
list(
mean = mean(data[[variable]], na.rm = TRUE),
grand_mean = mean(full_data[[variable]], na.rm = TRUE)
)
}
ADSL |>
dplyr::group_by(ARM) |>
ard_complex(
variables = "AGE",
statistic = list(AGE = list(means = grand_mean))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.