# NOT RUN {
fv_percent(1:4)
fv_percent(sample(1:100, 20))
# }
# NOT RUN {
library(tidyverse)
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(perc = fv_percent(n, digits = 0))
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(perc = fv_percent(n, digits = 0)) %>%
ggplot(aes(gear, n)) +
geom_bar(stat = 'identity') +
facet_wrap(~cyl, ncol = 1) +
geom_text(aes(y = n + 1, label = perc))
# }
Run the code above in your browser using DataLab