cat_freqs: Create column for frequency distribution of data

Description Usage Arguments Value Examples

Description

Create column for frequency distribution of data

Usage

1
2
3
cat_freqs(x, omit.na = F, NAname = NA, digits = 1,
  out = c("percentage", "percent"), perc.disp = F, escape = F,
  zero2dash = T)

Arguments

x

vector of characters or factors

omit.na

logical for ommision of NAs in computation of counts and proportions

digits

number of digits to round

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

Value

dataframe/tibble with two columns, one for category name, and one with N (\

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

Ajfrick/AVRCHelp documentation built on May 28, 2019, 1:34 a.m.