freqTable | R Documentation |
A frequency table emulating the SPSS FREQ output is generated.
freqTable(
x,
levels = sort(unique(as.character(x))),
missing = NULL,
description = NULL,
round = 1,
plot = FALSE
)
x |
vector of values to show frequencies for |
levels |
(optional) vector for order of levels in |
missing |
vector of levels for which we consider missing and don't count in the valid percentage |
description |
(optional) description for each level of |
round |
number of digits to round percentages to |
plot |
logical; if |
A data frame with the following columns
Class |
Tells you which scores are valid and which are missing. Not shown if there are no missing values. |
Score |
Different levels |
Frequency |
Count for each score |
Percent |
Percent of Frequency out of the grand total |
Valid Percent |
Percent of Frequency out of the Valid scores. Not applicable if there are no missing values. |
Cumulative Percent |
Accumulated Percent of Frequency out of the Valid Scores |
Description |
If |
Derek Chiu
freq()
# Create vector of randomly reordered alphabet with various frequencies
# for each letter
set.seed(123)
n <- sample(10, length(letters), replace = TRUE)
x <- sample(rep.int(letters, times = n))
freqTable(x, plot = TRUE)
# Treat vowels as missing
freqTable(x, missing = c("a", "e", "i", "o", "u"), round = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.