Hello!
I am hoping a member of this group knows how to overcome this error "Data names and covariance matrix names do not match" which is traced back to the .lm.rrpp function used by several other functions including lm.rrpp and procD.gls. My lab has code that worked previously with these functions but now gives us this error and any new attempts also give us this error. The name.check function in geiger confirms that the data and phylogeny names match. Does anyone have any insights as to what may be going on?
For example, we have the vcv matrix from the phylogeny reeftr (trvcv) and two traits (cp7 and sl), one of which is a factor (cp7) .
name.check(reeftr,cp7)
"OK"
name.check(reeftr,sl)
"OK"
trvcv<-vcv(reeftr)
rdf <- rrpp.data.frame(x = cp7, y = sl)
sl_allpat <- lm.rrpp(y~x, SStype="I", Cov = trvcv, data = rdf, iter= 999)
->"Error: Data names and covariance matrix names do not match"
Interestingly, if we don't use rrpp.data.frame and use the named vectors instead we get a slightly different error, which also traces back to the .lm.rrpp function
sl_allpat <- lm.rrpp(sl~cp7, SStype="I", Cov = trvcv, data = NULL, iter= 999)
-> "Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent"
We get the same error if Cov=NULL as well. Then to compound it, if we re-run the code using the rrpp.data.frame now we no longer get "Error: Data names and covariance matrix names do not match" and instead get "Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent". So the function is potentially being influenced by something from the R environment? This happens with different datasets and on different machines, so I feel like we are missing something simple!
Thanks - any help would be much appreciated!
Sam