我正在使用 glmnet R 包。在今天之前,我使用它没有任何问题。我两天前安装了 caret,我在安装它时遇到了一些麻烦,但我通过重新安装一些软件包成功地完成了一些工作,比如。
这是我收到的错误消息:
Error in .fixupDimnames(.Object@Dimnames) :
could not find function "lengths"
我使用的是旧版本的 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
调用后得到错误:
gg <- glmnet(x=data, y=Y.train, family="binomial", alpha=0, lambda=1)
Y.train 是因子,data 是虚拟矩阵。但我认为问题不是数据的问题。 但它更可能是与包裹相关联的东西或我遗漏的类似东西。 如果有人有线索,那就太好了。
最佳答案
我重新安装了 Matrix_1.1-1.tar.gz,它成功了。 因此,您可以尝试更改您的 Matrix 包。
关于r - 无法运行 glmnet() R 包 : "could not find function "lengths"",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31965831/