My R sessionInfo() of the failed runs:
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base
other attached packages:
[1] caper_0.5.2 mvtnorm_1.0-2 MASS_7.3-35
[4] gsubfn_0.6-6 proto_0.3-10 picante_1.6-2
[7] nlme_3.1-118 vegan_2.2-1 lattice_0.20-29
[10] permute_0.8-3 ape_3.2
loaded via a namespace (and not attached):
[1] cluster_1.15.3 grid_3.1.2 Matrix_1.1-4
[4] mgcv_1.8-3 parallel_3.1.2 tcltk_3.1.2
[7] tools_3.1.2
I'm working on isolating which variables cause the specif failure upon interaction. (Update: There is no specific predictor, it's just the number of predictors going above a thresh hold determine by the # of species)
I have an error which appears to be internal to the "caper" package within R. The exact error is:
Error in if (any(stRes > robust)) { : missing value where TRUE/FALSE needed
Where the error occurs on this line of code:
crunchMod <- crunch(f, data = contrasts)
Using dataSet1.txt
below with 7 predictors, I find that the regression works perfectly with )
, )^2
and )^3
. Using dataSet2.txt
below with 12 predictors, I find that only ")" works and both )^2
and )^3
produce the error above. Here is the minimal code needed to reproduce my error:
library(caper)
library(ape)
setwd("Your_Directory")
caperDS <- read.table("dataSet1.txt", header = TRUE) #Also include "dataSet2.txt"
myTrees = read.nexus("Tree1.tre") #Also include "Tree2.tre"
contrasts <- comparative.data(myTrees, caperDS, Species)
f <- as.formula(paste(paste(names(caperDS)[2],"~"), paste(paste("(",paste(names(caperDS)[3:ncol(caperDS)], collapse="+"))),")^3")) #Vary this between ")", ")^2" and ")^3"
crunchMod <- crunch(f, data = contrasts)
print(summary(crunchMod))
Due to the space it took, I've redacted the data I provided earlier. Since it is now apparent that this error is a general problem (see below), you can find data sets to examine cited within http://cran.r-project.org/web/packages/caper/vignettes/caper.pdf