I am trying to compute Cronbach's Alpha in R. I have tried different packages. The structure of my data is:
test<-structure(list(participant = structure(c(6L, 19L, 25L, 27L, 28L,
30L), .Label = c("1388", "1442", "1496", "1523", "1740", "2005",
"2686", "2703", "3198", "3355", "357", "3606", "3867", "4136",
"4351", "4355", "4600", "4729", "4787", "4798", "4890", "4940",
"5068", "5089", "5296", "5427", "6029", "6173", "6244", "6401",
"6468", "6688", "6719", "7034", "7143", "717", "7425", "7481",
"7621", "7724", "7788", "7817", "7881", "8103", "8386", "8414",
"8622", "8650", "8676", "9063", "9156", "9490"), class = "factor"),
`Resources/images/fish.png` = c(NA, 1, NA, 1, 1, NA), `Resources/images/bubbles.png` = c(1,
1, 1, 1, NA, NA), `Resources/images/boy_wash.png` = c(1,
NA, 1, NA, NA, NA), `Resources/images/clean.png` = c(0, NA,
1, NA, NA, NA)), row.names = c(NA, -6L), groups = structure(list(
participant = structure(c(6L, 19L, 25L, 27L, 28L, 30L), .Label = c("1388",
"1442", "1496", "1523", "1740", "2005", "2686", "2703", "3198",
"3355", "357", "3606", "3867", "4136", "4351", "4355", "4600",
"4729", "4787", "4798", "4890", "4940", "5068", "5089", "5296",
"5427", "6029", "6173", "6244", "6401", "6468", "6688", "6719",
"7034", "7143", "717", "7425", "7481", "7621", "7724", "7788",
"7817", "7881", "8103", "8386", "8414", "8622", "8650", "8676",
"9063", "9156", "9490"), class = "factor"), .rows = structure(list(
1L, 2L, 3L, 4L, 5L, 6L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))
print(test)
Now cronbach.alpha from "ltm" package gives:
cronbach.alpha(test)
# Error in cronbach.alpha(test1) : missing values in 'data'.
Package 'coefficientalpha' gives:
alpha (test)
# Error in xi_o - mu_o : non-numeric argument to binary operator
# In addition: Warning message:
# Setting row names on a tibble is deprecated.
As you can see my data is binary (0/1), coded as numeric, and has missing values for participants who made no choice. I get the same errors is I remove participants who only made one choice.
Thanks in advance!!