I have imported my data. The columns in question only contain numbers and NA
.
I try to compute the cronbach's-alpha
between my 4 variables as follows (there are more variables in the dataframe):
library(psych)
alpha (df$column1, df$column2, df$column3, df$columns4)
I get the following error:
Data must either be a data frame or a matrix
What could be the problem / the solution? This is probably very basic. But so am I. Thanks in advance!
Greetings from Berlin Paul
Here is one work around
df <- data.frame(df$column1, df$column2, df$column3, df$columns4)
alpha(df)
See ?alpha
for detail.
The input alpha
expects is a data.frame or matrix of data, or a covariance or correlation matrix
. You can create a dataframe out of the desired columns and pass that to alpha
with additional arguments if you want.