Learn R Programming

arsenal (version 0.5.0)

freqlist: freqlist

Description

Approximate the output from SAS's PROC FREQ procedure when using the /list option of the TABLE statement.

Usage

freqlist(tab, sparse = FALSE, na.options = c("include", "showexclude",
  "remove"), digits = 2, labelTranslations = NULL, groupBy = NULL, ...)

# S3 method for freqlist print(x, ...)

Arguments

tab

an object of class "table" or class "xtabs"

sparse

a logical value indicating whether to keep rows with counts of zero. The default is FALSE.

na.options

a character string indicating how to handling missing values: 'include' (include values with NAs in counts and percentages), 'showexclude' (show NAs but exclude from cumulative counts and all percentages), 'remove' (remove values with NAs); default is 'include'

digits

a single number indicating the number of digits for percentages (passed to round; default is 2.

labelTranslations

an optional character string of labels to use for variable levels when summarizing.

groupBy

an optional character string specifying a variable(s) to use for grouping when calculating cumulative counts and percentages. summary.freqlist will also separate by grouping variable for printing.

...

additional arguments passed to the kable function

x

an object of class "freqlist"

Value

An object of class "freqlist" (invisibly for print.freqlist)

See Also

table, xtabs, kable

Examples

Run this code
# NOT RUN {
# load mockstudy data
data(mockstudy)
tab.ex <- table(mockstudy[, c("arm", "sex", "mdquality.s")], useNA = "ifany")
noby <- freqlist(tab.ex, na.options = "include")
summary(noby)
withby <- freqlist(tab.ex, groupBy = c("arm","sex"), na.options = "showexclude")
summary(withby)
# }

Run the code above in your browser using DataLab