Assign default formatting functions for summary statistics
Source:R/stats-summary.R
assign_summary_digits.RdFor every variable, returns a named list of formatting functions keyed by
statistic. Continuous statistics default to a number of decimal places
guessed from the spread of the variable (the 5th to 95th percentile range:
below 0.01 gives 4 decimals, below 0.1 gives 3, below 10 gives 2, below 20
gives 1, otherwise 0); integer variables get 0 decimals and dates are shown
as text. Counts are formatted with style_number() and percentages with
style_percent(). User-supplied integers become label_style_number()
(with scale = 100 for percentages) and user-supplied functions are used
as is.
Arguments
- data
(
data.frame)
A data frame.- statistic
(named
list)
Statistic templates keyed by variable, e.g.list(age = "{mean} ({sd})").- type
(named
list)
Summary types keyed by variable.- digits
(named
list)
User-specified digits keyed by variable: an integer, a vector of integers, a function, or a named list of either.
See also
Other summary engine:
assign_summary_type()