countr | R Documentation |
Formats and prints a named vector of counts with percents.
countr(
x,
n,
lowcase = NA,
frac = FALSE,
digits = 0L,
which = seq_along(x),
conf = NULL,
show_conf = TRUE
)
x |
named vector of counts (a summary or table) or a long vector of character strings or factors |
n |
total number of observations; if not given, the length of
|
lowcase |
logical; names will be lowercase if |
frac |
logical; if |
digits |
number of digits past the decimal point to keep |
which |
optional integer or character vector to select or re-order the output; note that this does not change the counts or percentages |
conf , show_conf |
optional arguments controlling binomial confidence
intervals, passed to |
x <- setNames(3:1, c('Gold', 'Silver', 'Bronze'))
countr(x)
countr(x, conf = 0.95)
countr(x, n = 10, frac = TRUE)
countr(x, n = 10, frac = TRUE, which = 2)
## using a character/factor vector, not counts
countr(names(x))
countr(names(x), which = 1)
countr(names(x), which = c(3, 1), frac = TRUE)
countr(names(x), which = 'Silver', lowcase = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.