library(EFAfactors)
set.seed(123)
##Take the data.bfi dataset as an example.
data(data.bfi)
response <- as.matrix(data.bfi[, 1:25]) ## loading data
response <- na.omit(response) ## Remove samples with NA/missing values
## Transform the scores of reverse-scored items to normal scoring
response[, c(1, 9, 10, 11, 12, 22, 25)] <- 6 - response[, c(1, 9, 10, 11, 12, 22, 25)] + 1
## Run KGC function with default parameters.
# \donttest{
KGC.obj <- KGC(response)
print(KGC.obj)
plot(KGC.obj)
## Get the eigen.value, eigen.ref and nfact results.
eigen.value <- KGC.obj$eigen.value
nfact <- KGC.obj$nfact
print(eigen.value)
print(nfact)
# }
Run the code above in your browser using DataLab