Search code examples
rpsych

Export Cronbach Alpha Results - R


I'm following THIS R Blogger tutorial to calculate Cronbach alpha, which works perfectly. I'd like to learn how to export the results, either into a data.frame or text file. Any ideas how I might be able to export the results from the following code: psych::alpha(d)? Note, I looked at the stargazer package, but couldn't get it work work with Cronbach outputs only regression and descriptive statistics. Thank you.


Solution

  • The output can be saved as a txt file this way. You can also subset the object created with the alpha function using the $ operator to get only the information you are interested in.

    setwd("~/Desktop")
    out <- psych::alpha(d)
    capture.output(out,file = "alpha.txt")