# NOT RUN {
library(dplyr)
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(
p = numform::f_pp(n/sum(n))
) %>%
ungroup() %>%
mutate(
cyl = numform::fv_runs(cyl),
` ` = f_text_bar(n) ## Overall
) %>%
as.data.frame()
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(
p = numform::f_pp(n/sum(n)),
` ` = f_text_bar(n) ## within groups
) %>%
ungroup() %>%
mutate(
cyl = numform::fv_runs(cyl),
` ` = f_text_bar(n)
) %>%
as.data.frame()
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(
p = numform::f_pp(n/sum(n)),
`within` = f_text_bar(n, width = 3, symbol = '#')
) %>%
ungroup() %>%
mutate(
cyl = numform::fv_runs(cyl),
`overall` = f_text_bar(n, width = 30, symbol = '*')
) %>%
as.data.frame() %>%
pander::pander(split.tables = Inf, justify = alignment(.), style = 'simple')
## Drop the headers
mtcars %>%
count(cyl, gear) %>%
group_by(cyl) %>%
mutate(
p = numform::f_pp(n/sum(n)),
` ` = f_text_bar(n, symbol = '=')
) %>%
ungroup() %>%
mutate(
cyl = numform::fv_runs(cyl),
` ` = f_text_bar(n, symbol = '#')
) %>%
as.data.frame()
# }
Run the code above in your browser using DataLab