# -------------------------------
# Data from the EUROFAMCARE sample dataset
# -------------------------------
library(sjmisc)
data(efc)
# retrieve variable and value labels
varlabs <- get_label(efc)
# recveive first item of COPE-index scale
start <- which(colnames(efc) == "c82cop1")
# recveive last item of COPE-index scale
end <- which(colnames(efc) == "c90cop9")
# create data frame with COPE-index scale
mydf <- data.frame(efc[, c(start:end)])
colnames(mydf) <- varlabs[c(start:end)]
sjt.itemanalysis(mydf)
# -------------------------------
# auto-detection of labels
# -------------------------------
sjt.itemanalysis(efc[, c(start:end)])
# ---------------------------------------
# Compute PCA on Cope-Index, and perform a
# item analysis for each extracted factor.
# ---------------------------------------
factor.groups <- sjt.pca(mydf, no.output = TRUE)$factor.index
sjt.itemanalysis(mydf, factor.groups)
Run the code above in your browser using DataLab