mock {cards} | R Documentation |
Mock ARDs
Description
Create empty ARDs used to create mock tables or table shells.
Where applicable, the formatting functions are set to return 'xx'
or 'xx.x'
.
Usage
mock_categorical(
variables,
statistic = everything() ~ c("n", "p", "N"),
by = NULL
)
mock_continuous(
variables,
statistic = everything() ~ c("N", "mean", "sd", "median", "p25", "p75", "min", "max"),
by = NULL
)
mock_dichotomous(
variables,
statistic = everything() ~ c("n", "p", "N"),
by = NULL
)
mock_missing(
variables,
statistic = everything() ~ c("N_obs", "N_miss", "N_nonmiss", "p_miss", "p_nonmiss"),
by = NULL
)
mock_attributes(label)
mock_total_n()
Arguments
variables |
( a named list for functions |
statistic |
( |
by |
(named |
label |
(named |
Value
an ARD data frame of class 'card'
Examples
mock_categorical(
variables =
list(
AGEGR1 = factor(c("<65", "65-80", ">80"), levels = c("<65", "65-80", ">80"))
),
by = list(TRTA = c("Placebo", "Xanomeline High Dose", "Xanomeline Low Dose"))
) |>
apply_fmt_fun()
mock_continuous(
variables = c("AGE", "BMIBL"),
by = list(TRTA = c("Placebo", "Xanomeline High Dose", "Xanomeline Low Dose"))
) |>
# update the mock to report 'xx.xx' for standard deviations
update_ard_fmt_fun(variables = c("AGE", "BMIBL"), stat_names = "sd", fmt_fun = \(x) "xx.xx") |>
apply_fmt_fun()