cards icon indicating copy to clipboard operation
cards copied to clipboard

make the naming of the summary functions `*_summary_fns()` consistent with the `ard_*()` naming convention

Open statasaurus opened this issue 1 year ago • 1 comments

Feature description

No response

statasaurus avatar Apr 08 '24 07:04 statasaurus

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

ddsjoberg avatar May 20 '24 16:05 ddsjoberg