
Last chance! 50% off unlimited learning
Sale ends in
Approximate the output from SAS's PROC FREQ
procedure when using the /list
option of the TABLE
statement.
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,
strata = NULL, labelTranslations = NULL, control = NULL, addNA,
exclude, drop.unused.levels, ...)
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
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"
.
(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!)
an optional character string (or list) of labels to use for variable levels when summarizing. Names will be matched appropriately.
control parameters to handle optional settings within freqlist
. See freq.control
Arguments passed to xtabs
. Note
that addNA=
only works in R >= 3.4.0.
An object of class c("freqlist", "arsenal_table")
arsenal_table
, summary.freqlist
, freq.control
, freqlist.internal
,
table
, xtabs
# 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