我的 R sessionInfo() 失败运行:
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
我正在努力隔离哪些变量在交互时导致特定失败。(更新:没有特定的预测器,它只是超过阈值的预测器数量由物种数量决定)
我有一个错误,它似乎是 R 中“caper”包的内部错误。确切的错误是:
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)
使用下面的 7 个预测变量,dataSet1.txt
我发现回归与和完美配合。使用下面的 12 个预测变量,我发现只有“)”有效并且两者都有效并产生上面的错误。这是重现我的错误所需的最少代码:)
)^2
)^3
dataSet2.txt
)^2
)^3
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))
由于占用的空间,我已经编辑了我之前提供的数据。由于现在很明显这个错误是一个普遍问题(见下文),您可以在http://cran.r-project.org/web/packages/caper/vignettes/caper.pdf中找到要检查的数据集