Last chance! 50% off unlimited learning
Sale ends in
Numeric columns get multiplied by 100 and formatted as percentages according to user specifications. This function excludes the first column of the input data.frame, assuming that it contains a descriptive variable. Other non-numeric columns are also excluded.
adorn_pct_formatting(
dat,
digits = 1,
rounding = "half to even",
affix_sign = TRUE
)
a data.frame with decimal values, typically the result of a call to adorn_percentages
on a tabyl
. If given a list of data.frames, this function will apply itself to each data.frame in the list (designed for 3-way tabyl
lists).
how many digits should be displayed after the decimal point?
method to use for rounding - either "half to even", the base R default method, or "half up", where 14.5 rounds up to 15.
should the % sign be affixed to the end?
a data.frame with formatted percentages
# NOT RUN {
mtcars %>%
tabyl(am, cyl) %>%
adorn_percentages("col") %>%
adorn_pct_formatting()
# }
Run the code above in your browser using DataLab