View source: R/report.multipleChoice.R
report.multipleChoice | R Documentation |
This function reports the frequencies of a specified event in multiple variables of a dataset. It converts the event of interest to numeric, calculates the frequency of the event, the number of valid and invalid entries for each variable, and optionally attaches variable labels.
report.multipleChoice(
data,
varNames,
event = 1,
attachLabels = FALSE,
dec.freq = 0,
language = "english"
)
data |
A data frame or an object of class |
varNames |
A vector of strings representing the names of the variables in the data frame. |
event |
A value (numeric or character) representing the event of interest to be reported.
This event is transformed to numeric 1 in each specified variable.
Default is |
attachLabels |
Logical, if |
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: |
A data frame with columns representing: 1) the frequency of the event, 2) the percentage of the event, 3) the number of valid (non-NA) entries, 4) the number of invalid (NA) entries for each specified variable.
Marjan Cugmas
data <- data.frame(A = c(1, 1, 2, NA), B = c(1, 2, 2, 1), C = c(NA, 1, 1, 1))
varNames <- c("A", "B", "C")
report.multipleChoice(data, varNames)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.