I'm trying to run Farrar-Glauber tests in R, using the mctest package. I've created a data.frame with all the variables that I want to test for multicollinearity. I'm trying to use the omcdiag function but I keep getting the following error:
Error in ncol(x) : object 'x' not found (the data frame definitely exists and works)
I've also tried versions of the data frame with and without y (my dependent variable). I've tried:
omcdiag(CO2_lowerdata, CO2_pc_cmice1)
omcdiag(CO2_lowerdata, CO2_pc_cmice1, na.rm = TRUE, Inter = TRUE, detr = 0.01, red = 0.5,
conf = 0.95)
omcdiag(CO2_lowerdata[,c(2:9)],CO2_lowerdata$CO2_pc_cmice1)
For all of these I get the following error:
Error in ncol(x) : object 'x' not found
I've also tried reading the data frame as a as.matrix
, data.matrix
, as.numeric
and with as.matrix(sapply(CO2_lowerdata, as.numeric))
However then I get this error message :
Error: $ operator is invalid for atomic vectors
Yet I'm not actually using $ in any of these
Hopefully this is something simple! Super grateful if anyone can help.
Many thanks