# A test data set with ten respondents
# and responses to three survey questions
# with response scales from 1 to 5.
testdata <- data.frame(
var_a = c(1,4,3,5,3,2,3,1,3,NA),
var_b = c(2,5,2,3,4,1,NA,2,NA,NA),
var_c = c(1,2,3,NA,3,4,4,5,NA,NA))
# Calculate response distribution indicators
resp_styles(testdata,
scale_min = 1,
scale_max = 5) |>
round(2) # round to second decimal
# Include respondents with NA values by decreasing the
# necessary number of valid responses per respondent.
resp_styles(testdata,
scale_min = 1,
scale_max = 5,
min_valid_responses = 0.2) |>
round(2) # round to second decimal
# Get counts of responses attributable to response styles.
resp_styles(testdata,
scale_min = 1,
scale_max = 5,
normalize = FALSE)
Run the code above in your browser using DataLab