tabsort: tabsort

Description Usage Arguments Value Examples

View source: R/tabsort.R

Description

Returns a sorted (descending) frequency tbl

Usage

1
2
3
tabsort(.data, ..., prop = TRUE, na_omit = TRUE, sort = TRUE)

ntbl(.data, ...)

Arguments

.data

Data

...

Unquoted column names of variables to include in table. Default is to use all columns.

prop

Logical indicating whether to include a proportion of total obs column.

na_omit

Logical indicating whether to exclude missing. If all responses are missing, a missing value is used as the single category.

sort

Logical indicating whether to sort the returned object.

Value

Frequency tbl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## generate example data
x <- sample(letters[1:4], 200, replace = TRUE)
y <- sample(letters[5:8], 200, replace = TRUE)

## count and sort frequencies for each vector
tabsort(x)
tabsort(y)

## combine x and y into data frame
dat <- data.frame(x, y)

## select columns and create freq table
tabsort(dat, x)
tabsort(dat, x, y)

tbltools documentation built on Feb. 9, 2019, 1:04 a.m.