Skip to content

Instantly share code, notes, and snippets.

@vsoch
Created August 4, 2018 11:41
Show Gist options
  • Save vsoch/83b5727f12cf7e3549e6c7e1bb53d30f to your computer and use it in GitHub Desktop.
Save vsoch/83b5727f12cf7e3549e6c7e1bb53d30f to your computer and use it in GitHub Desktop.
# This needs to already have been done
# install.packages("psych")
library(psych)
SCRATCH <- Sys.getenv("SCRATCH")
setwd(SCRATCH)
# This command assumes the file exists at /scratch/$USER/emotionzs.csv
alldata = read.csv("emotionzs.csv", header = FALSE)
ev <- eigen(cor(alldata)) # get eigenvalues
ap <- parallel(subject=nrow(alldata),var=ncol(alldata),
rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
# This will save to /scratch/$USER
save(nS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment