Returns a table of proportions for each possible response category.
Usage
response_prop(data, n_levels)
Arguments
- data
numeric vector or matrix of responses.
- n_levels
number of response categories.
Value
A table of response category proportions.
Examples
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