Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 class 'table'
freqlist(
  object,
  na.options = c("include", "showexclude", "remove"),
  strata = NULL,
  labelTranslations = NULL,
  control = NULL,
  ...
)

## S3 method for class '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")

Author(s)

Tina Gunderson, with revisions by Ethan Heinzen

See Also

Examples

# 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)

arsenal

An Arsenal of 'R' Functions for Large-Scale Statistical Summaries

v3.6.2
GPL (>= 2)
Authors
Ethan Heinzen [aut, cre], Jason Sinnwell [aut], Elizabeth Atkinson [aut], Tina Gunderson [aut], Gregory Dougherty [aut], Patrick Votruba [ctb], Ryan Lennon [ctb], Andrew Hanson [ctb], Krista Goergen [ctb], Emily Lundt [ctb], Brendan Broderick [ctb], Maddie McCullough [art]
Initial release
2021-02-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.