Description Usage Arguments Value Examples
Use a text symbol to create scaled horizontal bar plots of numeric vectors.
Note that you will have to coerce the table to a data.frame
in order
for the output to look pretty.
1 2 3 | f_text_bar(x, symbol = "_", width = 9, ...)
ff_text_bar(...)
|
x |
A numeric vector. |
symbol |
A sumbol to use for the bars. |
width |
The max width of the bar. |
... |
ignored. |
Returns a vector of concatenated symbols as a string that represent x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ## 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()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.