# NOT RUN {
f_percent(c(30, 33.45, .1))
f_percent(c(30, 33.45, .1), 1)
f_percent(c(0.0, 0, .2, -00.02, 1.122222, pi))
f_prop2percent(c(.30, 1, 1.01, .33, .222, .01))
f_pp(c(.30, 1, 1.01, .33, .222, .01))
f_percent(c(30, 33.45, .1), digits = 0, less.than.replace = TRUE)
## Escaped for LaTeX:
f_percent(c(30, 33.45, .1), digits = 0, less.than.replace = TRUE, s = '\\%')
f_prop2percent(c(.30, 1, 1.01, .33, .222, .01, .0001, NA), digits = 0,
less.than.replace = TRUE)
# }
# NOT RUN {
library(tidyverse)
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(prop = n/sum(n)) %>%
ggplot(aes(gear, prop)) +
geom_bar(stat = 'identity') +
facet_wrap(~cyl, ncol = 1) +
scale_y_continuous(labels = ff_prop2percent(digits = 0))
# }
Run the code above in your browser using DataLab