I am a beginner using R. I am struggling when I try to compute the Cronbach's alpha for multiple subscales. I was using the psych package to do it.
Here is an example of my database: I have 2 different subscales. Subscale A includes items 1 to 3 and Subscale B includes items 4 to 5.
Subscale Student Item1 Item2 Item3 Item4 Item5
A 1 1 0 1 NA NA
A 2 0 1 1 NA NA
A 3 1 1 1 NA NA
B 1 NA NA NA 1 1
B 2 NA NA NA 1 0
B 3 NA NA NA 0 0
To compute the Cronbach's alpha for each subscale at the same time. I tried to use psych package.
Reliability <- group_by(df,Subscale) %>%
alpha()
However, I get the following error: Likely variables with missing values are Item4 Item5 Error in principal(x, scores = FALSE) : I am sorry: missing values (NAs) in the correlation matrix do not allow me to continue. Please drop those variables and try again. In addition: Warning messages: 1: In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) : NAs introduced by coercion 2: In alpha(.) : Item = Subscale had no variance and was deleted
Is it possible to compute Cronbach's alpha for these subscales at the same time creating a new data frame or a list with the results? Or should I use the split function two separate the subscales and calculate the alphas for each one separately?
Thanks in advance!