A collection of functions that may help users create custom functions that are formatted correctly.
as.tbstat( x, oldClass = NULL, sep = NULL, parens = NULL, sep2 = NULL, pct = NULL, ... ) as.countpct( x, ..., which.count = setdiff(seq_along(x), which.pct), which.pct = 0L ) as.tbstat_multirow(x)
x | Usually a vector. |
---|---|
oldClass | class(es) to add to the resulting object. |
sep | The separator between |
parens | A length-2 vector denoting parentheses to use around |
sep2 | The separator between |
pct | For statistics of length 2, the symbol to use after the second one. (It's called "pct" because usually the first statistic is never a percent, but the second often is.) |
... | arguments to pass to |
which.count | Which statistics are counts? The default is everything except the things that are percents. |
which.pct | Which statistics are percents? The default is 0, indicating that none are. |
The vignette has an example on how to use these.
as.tbstat
defines a tableby statistic with its appropriate formatting.
as.countpct
adds another class to as.tbstat
to use different "digits" arguments
(i.e., digits.count
or digits.pct
). See tableby.control
.
as.tbstat_multirow
marks an object (usually a list) for multiple-row printing.