I'm analyzing an assessment that has 8 sections, 4 versions of each section that is randomly distributed to respondents.
I'm trying to get at item-analysis using the tab_itemscale() function of the sjPlot package, however it requires me to recode the string variables to numeric.
What is the best practice around this since I don't know how corresponding A, B, C and D responses to a numeric value may affect the understandings of the item.
I don't want to recode to you either getting a 1 or 0 if you got the answer correct because I'd like to understand each individual response and item difficulty.
Thanks for the help!
I created this function:
factorise <- function(x) {
case_when(x %in% c("A") ~ 1,
x %in% c("B") ~ 2,
x %in% c("C") ~ 3,
x %in% c("D") ~ 4)
}
and applied it the the items of 1 section of 1 version:
WXM_M_v1[,c("M1V1", "M2V1", "M3V1", "M4V1", "M5V1", "M6V1", "M7V1", "M8V1")] <- lapply(WXM_M_v1[,c("M1V1", "M2V1", "M3V1", "M4V1", "M5V1", "M6V1", "M7V1", "M8V1")], factorise)
and then applying the function
tab_itemscale(WXM_M_v1)