describeFuns: Describe multiple functions

View source: R/utils2.R

describeFunsR Documentation

Describe multiple functions

Description

Concatenate one or more functions for output in tabler_stat.

Usage

describeFuns(x, FUN, ...)

Arguments

x

a vector to be described by each FUN

FUN

a list of functions that each return a named string; if FUN is a named list, all non zero length names will take precedence; if neither are available, names will be guessed based on the list

...

ignored

Examples

describeFuns(1:10, FUN = list(mean, median))
describeFuns(1:10, FUN = list(Gmisc::describeMean, Gmisc::describeMedian))
describeFuns(1:10, FUN = list(function(...) Gmisc::describeMedian(..., iqr = FALSE)))


## typical usage
ff <- list(
  'Median (full range)' = function(...) Gmisc::describeMedian(..., iqr = FALSE),
  Gmisc::describeMean,
  Min = min, Max = max
)
  
tabler_stat2(
  mtcars, c('mpg', 'wt'), 'gear', FUN = NA,
  statArgs = list(continuous_fn = function(...) describeFuns(..., FUN = ff))
)


raredd/rawr documentation built on March 4, 2024, 1:36 a.m.