# dichotomous data example
LSAT7full <- expand.table(LSAT7)
head(LSAT7full)
itemstats(LSAT7full)
# behaviour with missing data
LSAT7full[1:5,1] <- NA
itemstats(LSAT7full)
# data with no meaningful total score
head(SAT12)
itemstats(SAT12, use_ts=FALSE)
# extra total scores tables
dat <- key2binary(SAT12,
key = c(1,4,5,2,3,1,2,1,3,1,2,4,2,1,
5,3,4,4,1,4,3,3,4,1,3,5,1,3,1,5,4,5))
itemstats(dat, ts.tables=TRUE)
# grouping information
group <- gl(2, 300, labels=c('G1', 'G2'))
itemstats(dat, group=group)
#####
# polytomous data example
itemstats(Science)
# polytomous data with missing
newScience <- Science
newScience[1:5,1] <- NA
itemstats(newScience)
# unequal categories
newScience[,1] <- ifelse(Science[,1] == 1, NA, Science[,1])
itemstats(newScience)
merged <- data.frame(LSAT7full[1:392,], Science)
itemstats(merged)
Run the code above in your browser using DataLab