View source: R/report.ordinal.R
report.ordinal | R Documentation |
This function reports statistics for ordinal variables in a dataset. It calculates proportions or counts of each level, the total count of valid (non-NA) entries, mean, and standard deviation.
report.ordinal(
ordVarNames,
data,
type = 1,
dec = 1,
dec.freq = 0,
language = "english",
attachLabels = FALSE
)
ordVarNames |
A vector of strings representing the names of the ordinal variables in the dataset. |
data |
A data frame or an object of class |
type |
An integer indicating the type of the report: 1 = proportions (default), 2 = counts, 3 = counts and proportions. |
dec |
The number of decimal places to round the values. |
dec.freq |
Number of decimal places for frequencies. Defaults is |
language |
The language used for displaying the statistics in the frequency table. This parameter accepts two values: |
attachLabels |
Logical, if |
A matrix with rows representing each specified ordinal variable, and columns representing: 1) proportions or counts (or both) of each level (one column per level), 2) total count of valid (non-NA) entries, 3) mean, 4) standard deviation.
Marjan Cugmas
data <- data.frame(A = factor(c(1, 2, 3, 2), ordered = TRUE),
B = factor(c(2, 3, 2, 1), ordered = TRUE))
ordVarNames <- c("A", "B")
report.ordinal(ordVarNames, data, type = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.