简体   繁体   中英

Can't run glmnet() R package : “ could not find function ”lengths“ ”

I'm using glmnet R package. 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.

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. 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. So, you can try to change your Matrix package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM