add_calculated_row {cards} | R Documentation |
Add Calculated Row
Description
Use this function to add a new statistic row that is a function of the other statistics in an ARD.
Usage
add_calculated_row(
x,
expr,
stat_name,
by = c(all_ard_groups(), all_ard_variables(), any_of("context")),
stat_label = stat_name,
fmt_fn = NULL
)
Arguments
x |
( |
expr |
( |
stat_name |
( |
by |
( |
stat_label |
( |
fmt_fn |
( |
Value
an ARD data frame of class 'card'
Examples
ard_continuous(mtcars, variables = mpg) |>
add_calculated_row(expr = max - min, stat_name = "range")
ard_continuous(mtcars, variables = mpg) |>
add_calculated_row(
expr =
dplyr::case_when(
mean > median ~ "Right Skew",
mean < median ~ "Left Skew",
.default = "Symmetric"
),
stat_name = "skew"
)
[Package cards version 0.2.2 Index]