• continuous_summary_fns() returns a named list of summary functions for continuous variables. Some functions include slight modifications to their base equivalents. For example, the min() and max() functions return NA instead of Inf when an empty vector is passed. Statistics "p25" and "p75" are calculated with quantile(type = 2), which matches SAS's default value.

continuous_summary_fns(
  summaries = c("N", "mean", "sd", "median", "p25", "p75", "min", "max"),
  other_stats = NULL
)

Arguments

summaries

(character)
a character vector of results to include in output. Select one or more from 'N', 'mean', 'sd', 'median', 'p25', 'p75', 'min', 'max'.

other_stats

(named list)
named list of other statistic functions to supplement the pre-programmed functions.

Value

named list of summary statistics

Examples

# continuous variable summaries
ard_summary(
  ADSL,
  variables = "AGE",
  statistic = ~ continuous_summary_fns(c("N", "median"))
)
#> # An ARD data frame: 2 × 8
#>   variable context stat_name stat_label   stat fmt_fun warning error 
#> * <chr>    <chr>   <chr>     <chr>      <list>  <list> <list>  <list>
#> 1 AGE      summary N         N             254       0 <NULL>  <NULL>
#> 2 AGE      summary median    Median         77       1 <NULL>  <NULL>