quick_table: Tabulate data

Description Usage Arguments Value Examples

View source: R/rle2.R

Description

Quick and simple function for creating contingency tables

Usage

1
quick_table(x, na.rm = FALSE, order = c("frequency", "value", "none"))

Arguments

x

a vector or factor object

na.rm

should NAs be included

order

how should the results be ordered, if any?

Value

A data.frame with columns val (the original values and class of x) and freq (the count, or frequency, of each value in x, integer). The rows are sorted by frequency in descending order.

Examples

1
2
3
4
5
6
7
8
set.seed(1)
m <- sample(c(rep(NA, 5), rpois(45, 3)))
quick_table(m)

x <- LETTERS[c(2, 2, 2, 2, 3, 1, 1)]
quick_table(x, order="freq")
quick_table(x, order="value")
quick_table(x, order="none")

AkselA/R-ymse documentation built on March 21, 2020, 9:52 a.m.