Tab: Simple table of counts and percentages

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/Tab.R

Description

Simple table of counts and percentages

Usage

1
Tab(var, digits = 2, useNA = c("no", "ifany", "always"))

Arguments

var

A variable.

digits

An integer indicating the number of decimals places to be used for rounding.

useNA

Should NA values be tabulated? Defaults to "no".

Details

If useNA = "ifany" then NA values will be included if any exist. If useNA = "always" then if var does not contain any NA values a count, percentage, and cumulative percentage of 0 will be reported.

Value

A table of counts, percentages, and cumulative percentages for levels of var.

Author(s)

Jonah Gabry <[email protected]>

See Also

xtabs, table, prop.table

Examples

1
2
3
4
5
6
x <- c(1,1,1,2,3,3,NA,NA)
y <- c(1,1,1,2,3,3)
Tab(x)
Tab(x, useNA = "ifany")
Tab(y, useNA = "always")
with(GSS_2010, Tab(partyid, digits = 3, useNA = "ifany"))

jgabry/QMSS_package documentation built on May 17, 2017, 7:22 p.m.