Closed statasaurus closed 3 weeks ago
After meeting with @bzkrouse
statistic = everything() ~ c("n", "p", "N")
ard_categorical()
showing how to get items like the mode for a categorical variableslibrary(cards)
get_mode <- function(x) {
table(x) |> sort(decreasing = TRUE) |> names() |> getElement(1L)
}
get_mode(mtcars$cyl)
#> [1] "8"
ADSL |>
ard_continuous(
variables = AGE,
statistic = list(AGE = list(mode = get_mode))
)
#> {cards} data frame: 1 x 8
#> variable context stat_name stat_label stat fmt_fn
#> 1 AGE continuo… mode mode 81 <fn>
#> ℹ 2 more variables: warning, error
Created on 2024-05-20 with reprex v2.1.0
Feature description
No response