Error : object ‘sigma’ is not exported by 'namespace:lme4'

Error : object ‘sigma’ is not exported by 'namespace:lme4'

更新 lme4 (1.1-12) 后,调用 varComp 包时出现此错误。

library(varComp)
Error : object ‘sigma’ is not exported by 'namespace:lme4'
Error: package or namespace load failed for ‘varComp’

已编辑

这是我的sessionInfo()

sessionInfo()
R version 3.3.0 beta (2016-03-30 r70404)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lme4_1.1-12     Matrix_1.2-4    devtools_1.11.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4         Formula_1.2-1       roxygen2_5.0.1.9000 magrittr_1.5        cluster_2.0.3      
 [6] MASS_7.3-45         mutoss_0.1-10       splines_3.3.0       BiocGenerics_0.12.1 mnormt_1.5-4       
[11] xtable_1.8-2        colorspace_1.2-6    lattice_0.20-33     R6_2.1.2            quadprog_1.5-5     
[16] parallel_3.3.0      broom_0.4.0         latticeExtra_0.6-28 coda_0.18-1         TH.data_1.0-7      
[21] withr_1.0.1         MatrixModels_0.4-1  assertthat_0.1      digest_0.6.9        multtest_2.22.0    
[26] acepack_1.3-3.3     StroupGLMM_0.1.0    phia_0.2-1          scales_0.4.0        lsmeans_2.23       
[31] Hmisc_3.17-3        lmerTest_2.0-30     stats4_3.3.0        survey_3.30-3       munsell_0.4.3      
[36] multcomp_1.4-4      minqa_1.2.4         plyr_1.8.3          dplyr_0.4.3.9000    stringr_1.0.0      
[41] car_2.1-2           tools_3.3.0         grid_3.3.0          nnet_7.3-12         pbkrtest_0.4-6     
[46] nlme_3.1-127        Biobase_2.26.0      gtable_0.2.0        mgcv_1.8-12         quantreg_5.21      
[51] psych_1.5.8         plotrix_3.6-1       DBI_0.3.1           survival_2.39-2     gridExtra_2.2.1    
[56] ggplot2_2.1.0       tidyr_0.4.1         nloptr_1.0.4        reshape2_1.4.1      RColorBrewer_1.1-2 
[61] codetools_0.2-14    rpart_4.1-10        aod_1.3             memoise_1.0.0       sandwich_2.3-4     
[66] stringi_1.0-1       estimability_1.1-1  CompQuadForm_1.4.1  mvtnorm_1.0-5       SparseM_1.7        
[71] foreign_0.8-66      zoo_1.7-12      

varComp 包依赖于 RLRsimRLRsim 使用 S3 泛型 sigma,它在 R 3.3.0 中从 lme4 移动到 stats。如果在 R < 3.3.0 下为 RLRsim 使用 Windows 二进制文件,那么 RLRsim 将在 lme4 中查找 sigma 而不是在 [=17 中查找=]:

> install.packages("https://cran.r-project.org/bin/windows/contrib/3.2/RLRsim_3.1-2.zip", repos=NULL)
...
package ‘RLRsim’ successfully unpacked and MD5 sums checked
> library(varComp)
Error : object ‘sigma’ is not exported by 'namespace:lme4'
Error: package or namespace load failed for ‘varComp’

如果你重新安装 RLRsim 你应该得到一个最近的版本并且 varComp 将加载:

> install.packages("RLRsim")
...
package ‘RLRsim’ successfully unpacked and MD5 sums checked
...
> library(varComp)
>

我不确定这是一个答案还是一个解决方法,但对我来说,用 #' @imoprt package 而不是 #' @importFrom package function 作为 roxygen 文档字符串就可以了。错误的版本控制,我猜...