[英]Can't run glmnet() R package : “ could not find function ”lengths“ ”
I'm using glmnet R package. 我正在使用glmnet R包。 And before today I had no problems using it. 在今天之前,我使用它没有问题。 I installed caret two days ago, I had some troubles to install it but I succeeded to do some by re-installing some packages like. 两天前我安装了插入号,但在安装时遇到了一些麻烦,但通过重新安装某些软件包成功完成了一些操作。
Here is the error message I get : 这是我收到的错误消息:
Error in .fixupDimnames(.Object@Dimnames) :
could not find function "lengths"
I'm using an old version of R, that I can't update right now. 我使用的是R的旧版本,目前无法更新。
sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] glmnet_2.0-2 foreach_1.4.2 Matrix_1.2-2 caret_6.0-52 ggplot2_0.9.3.1 lattice_0.20-23 ade4_1.6-2
loaded via a namespace (and not attached):
[1] BradleyTerry2_1.0-6 brglm_0.5-9 car_2.0-19 codetools_0.2-11 colorspace_1.2-4 compiler_3.0.2
[7] dichromat_2.0-0 digest_0.6.4 grid_3.0.2 gtable_0.1.2 gtools_3.5.0 iterators_1.0.7
[13] labeling_0.2 lme4_1.1-8 MASS_7.3-29 minqa_1.2.4 munsell_0.4.2 nlme_3.1-111
[19] nloptr_1.0.4 nnet_7.3-7 plyr_1.8 pROC_1.8 proto_0.3-10 RColorBrewer_1.0-5
[25] Rcpp_0.12.0 reshape2_1.2.2 scales_0.2.3 splines_3.0.2 stats4_3.0.2 stringr_0.6.2
[31] tools_3.0.2
The error is obtained after calling : 在调用后获得错误:
gg <- glmnet(x=data, y=Y.train, family="binomial", alpha=0, lambda=1)
Y.train is factor, and data a matrix of dummies. Y.train是因子,数据是假人矩阵。 But I think that the issue is not a matter of data. 但是我认为问题不在于数据问题。 But it is more likely something linked with a package or something like this that I'm missing. 但这很有可能是与包装有关的东西或类似的东西而我所缺少的。 If anybody has a clue, it would be great. 如果有人有线索,那就太好了。
I reinstall Matrix_1.1-1.tar.gz, and it worked. 我重新安装了Matrix_1.1-1.tar.gz,它可以正常工作。 So, you can try to change your Matrix package. 因此,您可以尝试更改Matrix软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.