cat_freqs | R Documentation |
Create column for frequency distribution of data
cat_freqs(
x,
omit_na = T,
NAname = NA,
digits = 1,
incl_denom = F,
remove_na = F,
out = c("percentage", "percent"),
perc_disp = F,
escape = F,
zero2dash = T
)
x |
vector of characters or factors |
omit_na |
logical for ommision of NAs in computation of counts and proportions of non missing data |
digits |
number of digits to round |
incl_denom |
logical for inclusion of denominator when displaying frequencies |
remove_na |
logical for removal of frequency of missing data |
out |
single character representing output for proportion |
perc_disp |
logical for inclustion of % sign |
escape |
logical for inclusion of escape character for LaTeX tables |
zero2dash |
logical for returning "-" instead of "0 (0)" for tables |
dataframe/tibble with two columns, one for category name, and one with N (\
dat = iris
specs = dat$Species
cat_freqs(specs)
cat_freqs(iris$Species)
#Playing around with Missing data
set.seed(314159)
index_na = sample(1:nrow(dat), size = 25, replace = F)
dat[index_na,]$Species = NA
# Different output based on arguments to `omit_na`
cat_freqs(dat$Species) #omit_na = F default
cat_freqs(dat$Species, omit_na = T)
cat_freqs(dat$Species, incl_denom = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.