# -------------------------------
# Data from the EUROFAMCARE sample dataset
# -------------------------------
data(efc)
# retrieve variable and value labels
varlabs <- get_var_labels(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
df <- as.data.frame(efc[,c(start:end)])
colnames(df) <- varlabs[c(start:end)]
sjt.itemanalysis(df)
# -------------------------------
# auto-detection of labels
# -------------------------------
efc <- set_var_labels(efc, varlabs)
sjt.itemanalysis(efc[,c(start:end)])
# ---------------------------------------
# Compute PCA on Cope-Index, and perform a
# item analysis for each extracted factor.
# ---------------------------------------
factor.groups <- sjt.pca(df, no.output=TRUE)$factor.index
sjt.itemanalysis(df, factor.groups)
Run the code above in your browser using DataLab