cards
cards copied to clipboard
make the naming of the summary functions `*_summary_fns()` consistent with the `ard_*()` naming convention
Feature description
No response
After meeting with @bzkrouse
- [x] remove missing and categorical versions of these summary functions
- [x] update API for categorical to be
statistic = everything() ~ c("n", "p", "N") - [x] add example to
ard_categorical()showing how to get items like the mode for a categorical variables
library(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