freq_vect: freq_vect

Description Usage Arguments Value Examples

Description

freq_vect returns a frequency table with counts and percentages of values from an atomic vector of type character, integer, double, or logical

Usage

1
freq_vect(data_vector, sort_by_count = FALSE, total_row = TRUE)

Arguments

data_vector

an atomic vector of type character, integer, double, or logical

sort_by_count

boolean value that determines if output will be sorted by count or name

total_row

a boolean value that determines if the output will have a summary row appended

Value

a data_frame containing the counts and percentages of each value from the provided data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Sample vector and data frame to demo the freq_vect function.
numbers <- sample(1:10, 200, replace = TRUE)
tbl     <- data.frame(numbers = sample(1:10, 200, replace = TRUE),
  letters = sample(letters, 200, replace = TRUE),
  dates = sample(seq(as.Date('1999/10/01'), as.Date('2000/01/01'), by="day"),
                 200, replace = TRUE),
  logicals = sample(c(TRUE, FALSE), 200, replace = TRUE),
  stringsAsFactors = FALSE)

freq_vect(numbers)
freq_vect(tbl$numbers)
freq_vect(tbl$letters, sort_by_count = TRUE, total_row = FALSE)
freq_vect(mtcars$cyl)

DataInsightPartners/frequencies documentation built on May 8, 2019, 9:57 p.m.