dat <- data.frame(item1 = c(3, 2, 4, 1, 5, 1, 3, NA),
item2 = c(2, 2, NA, 2, 4, 2, NA, 1),
item3 = c(1, 1, 2, 2, 4, 3, NA, NA),
item4 = c(4, 2, 4, 4, NA, 2, NA, NA),
item5 = c(3, NA, NA, 2, 4, 3, NA, 3))
# Example 1a: Prorated mean scale scores
item.scores(dat)
# Example 1b: Alternative specification using the 'data' argument
item.scores(., data = dat)
# Example 2: Prorated standard deviation scale scores
item.scores(dat, fun = "sd")
# Example 3: Sum scale scores without proration
item.scores(dat, fun = "sum", prorated = FALSE)
# Example 4: Prorated mean scale scores,
# minimum proportion of available item responses = 0.8
item.scores(dat, p.avail = 0.8)
# Example 5: Prorated mean scale scores,
# minimum number of available item responses = 3
item.scores(dat, n.avail = 3)
Run the code above in your browser using DataLab