Learn R Programming

arsenal (version 3.6.3)

freqlist: freqlist

Description

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

Usage

freqlist(object, ...)

# S3 method for table freqlist( object, na.options = c("include", "showexclude", "remove"), strata = NULL, labelTranslations = NULL, control = NULL, ... )

# S3 method for formula freqlist( formula, data, subset, na.action, na.options = c("include", "showexclude", "remove"), strata = NULL, labelTranslations = NULL, control = NULL, addNA, exclude, drop.unused.levels, ... )

Arguments

object

An R object, usually of class "table" or class "xtabs"

...

additional arguments. In the formula method, these are passed to the table method. These are also passed to freq.control

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".

strata

(formerly 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. Note that this is different from modelsum and tableby, which take bare column names (and only one, at that!)

labelTranslations

an optional character string (or list) of labels to use for variable levels when summarizing. Names will be matched appropriately.

control

control parameters to handle optional settings within freqlist. See freq.control

formula, data, subset, na.action, addNA, exclude, drop.unused.levels

Arguments passed to xtabs.

Value

An object of class c("freqlist", "arsenal_table")

See Also

arsenal_table, summary.freqlist, freq.control, freqlist.internal, table, xtabs

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)

# show the top 6 rows' frequencies and percents
head(summary(sort(noby, decreasing = TRUE)[c(1:4, 6)]))

withby <- freqlist(tab.ex, strata = c("arm","sex"), na.options = "showexclude")
summary(withby)
# }

Run the code above in your browser using DataLab