R/utilities.R
response_prop.Rd
Returns a table of proportions for each possible response category.
response_prop(data, n_levels)
numeric vector or matrix of responses.
number of response categories.
A table of response category proportions.
data <- c(1, 2, 2, 3, 3, 3) response_prop(data, n_levels = 3) #> 1 2 3 #> 0.1666667 0.3333333 0.5000000 data_matrix <- matrix(c(1, 2, 2, 3, 3, 3), ncol = 2) response_prop(data_matrix, n_levels = 3) #> Response #> Item 1 2 3 #> [1,] 0.3333333 0.6666667 0 #> [2,] 0.0000000 0.0000000 1