insightsengineering / cards

CDISC Analysis Results Data
https://insightsengineering.github.io/cards/
24 stars 0 forks source link

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

Closed statasaurus closed 3 weeks ago

statasaurus commented 3 months ago

Feature description

No response

ddsjoberg commented 1 month ago

After meeting with @bzkrouse

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