我使用来自汽车包的linearHypothesis和我正在处理的数据得到错误,即使我使用帮助文件中的测试数据和代码,我也会收到同样的错误。但是,其他人不会在不同的操作系统上安装不同的错误。
直接来自帮助文件:
实施例
mod.davis <- lm(weight ~ repwt, data=Davis)
## the following are equivalent:
linearHypothesis(mod.davis, diag(2), c(0,1))
linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"))
linearHypothesis(mod.davis, c("(Intercept)", "repwt"), c(0,1))
linearHypothesis(mod.davis, c("(Intercept)", "repwt = 1"))
## use asymptotic Chi-squared statistic
linearHypothesis(mod.davis, c("(Intercept) = 0", "repwt = 1"), test = "Chisq")
导致以下许多错误: &#34;顺序错误(nchar(cnames),减去= TRUE): 4个参数传递给.Internal(nchar),需要3&#34;
我的sessionInfo():
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
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 datasets methods base
other attached packages:
[1] car_2.1-0
loaded via a namespace (and not attached):
[1] Rcpp_0.11.5 lattice_0.20-31 MASS_7.3-40 grid_3.2.0
[5] nlme_3.1-120 MatrixModels_0.4-1 SparseM_1.7 minqa_1.2.4
[9] nloptr_1.0.4 Matrix_1.2-0 splines_3.2.0 lme4_1.1-7
[13] pbkrtest_0.4-2 parallel_3.2.0 mgcv_1.8-6 nnet_7.3-9
[17] quantreg_5.19
然后一位朋友在另一台计算机上使用以下sessionInfo()运行它没有错误。知道发生了什么吗?
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] car_2.0-25
loaded via a namespace (and not attached):
[1] grid_3.0.2 lattice_0.20-29 lme4_1.1-7 MASS_7.3-34 Matrix_1.1-4
[6] mgcv_1.8-3 minqa_1.2.3 nlme_3.1-117 nloptr_1.0.4 nnet_7.3-8
[11] parallel_3.0.2 pbkrtest_0.4-2 quantreg_5.11 Rcpp_0.11.2 SparseM_1.6
[16] splines_3.0.2 tools_3.0.2