stats.apply.rounding: Apply rounding to basic descriptive statistics.
Description
Not all statistics should be rounded in the same way, or at all. This
function will apply rounding selectively to a list of statistics as returned
by stats.default. In particular we don't round counts (N and
FREQ), and for MIN, MAX and MEDIAN the digits is interpreted as the
minimum number of significant digits, so that we don't loose any
precision. Percentages are rounded to a fixed number of decimal places
(default 1) rather than a specific number of significant digits.
A list with the same number of elements as x. The rounded
values will be character (not numeric) and will have 0 padding
to ensure consistent number of significant digits.
Arguments
x
A list, such as that returned by stats.default.
digits
An integer specifying the number of significant digits to keep.
digits.pct
An integer specifying the number of digits after the
decimal place for percentages.
round.median.min.max
Should rounding applied to median, min and max?
round.integers
Should rounding be limited to digits to the right of
the decimal point?
round5up
Should numbers with 5 as the last digit always be rounded
up? The standard R approach is "go to the even digit" (IEC 60559 standard,
see round), while some other softwares (e.g. SAS, Excel)
always round up.
rounding.fn
The function to use to do the rounding. Defaults to
signif_pad.