freq | R Documentation |
This is a frequency table function which prints the frequency and related row percentage for a given categorical variable.The function creates the count and related row percentages for a given categorical variables and allows naming the header. Provide the distinct level names as a list.
freq(var, row, colnames)
var |
A categorical variable to be analyzed |
row |
Row name for the output |
colnames |
Level names for the categorical variable |
#Example
set.seed(1234)
letter = list(sample(letters[1:5], 20, replace=TRUE))
freq( letter, row = c("Letter"), colnames = c("A", "B", "C", "D", "E"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.