无法在 R 中安装 glmnet

Can't install glmnet in R

我正在尝试在 windows 64 位电脑上安装 R 版本 3.3.1 (2016-06-21) 中的 glmnet 包(版本:2.0-5)。但是,我收到以下消息。

installed.packages("glmnet")
 Package LibPath Version Priority Depends Imports LinkingTo Suggests Enhances License

 License_is_FOSS License_restricts_use OS_type Archs MD5sum NeedsCompilation Built

有什么问题吗?

很难说有什么问题。代码:

installed.packages("glmnet")

... 没有安装任何东西。你应该试试这个:

install.packages("glmnet", dependencies=TRUE)

glmnet 包有很多依赖项。这是我刚安装时看到的:

also installing the dependencies ‘mime’, ‘iterators’, ‘evaluate’, ‘formatR’, ‘highr’, ‘markdown’, ‘yaml’, ‘foreach’, ‘knitr’, ‘lars’

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/mime_0.5.tgz'
Content type 'application/x-gzip' length 24884 bytes (24 KB)
==================================================
downloaded 24 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/iterators_1.0.8.tgz'
Content type 'application/x-gzip' length 310135 bytes (302 KB)
==================================================
downloaded 302 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/evaluate_0.10.tgz'
Content type 'application/x-gzip' length 45380 bytes (44 KB)
==================================================
downloaded 44 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/formatR_1.4.tgz'
Content type 'application/x-gzip' length 44156 bytes (43 KB)
==================================================
downloaded 43 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/highr_0.6.tgz'
Content type 'application/x-gzip' length 28351 bytes (27 KB)
==================================================
downloaded 27 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/markdown_0.7.7.tgz'
Content type 'application/x-gzip' length 170142 bytes (166 KB)
==================================================
downloaded 166 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/yaml_2.1.13.tgz'
Content type 'application/x-gzip' length 168121 bytes (164 KB)
==================================================
downloaded 164 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/foreach_1.4.3.tgz'
Content type 'application/x-gzip' length 382270 bytes (373 KB)
==================================================
downloaded 373 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/knitr_1.14.tgz'
Content type 'application/x-gzip' length 940484 bytes (918 KB)
==================================================
downloaded 918 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/lars_1.2.tgz'
Content type 'application/x-gzip' length 200050 bytes (195 KB)
==================================================
downloaded 195 KB

trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/mavericks/contrib/3.3/glmnet_2.0-5.tgz'
Content type 'application/x-gzip' length 1788514 bytes (1.7 MB)
==================================================
downloaded 1.7 MB


The downloaded binary packages are in
    /var/folders/68/vh2f8kzn09j8954r6q9100yh0000gn/T//Rtmp5fI1D2/downloaded_packages

那么您的代码的结果没有任何变化。 (我从未使用过 installed.packages 函数,所以我真的不知道这是否是预期的行为。

> installed.packages("glmnet")
     Package LibPath Version Priority Depends Imports LinkingTo Suggests
     Enhances License License_is_FOSS License_restricts_use OS_type Archs MD5sum
     NeedsCompilation Built

所以@bethanyP 建议查看拼写(我不确定,也许只是函数名称)。我查看了 `installed.packages 的帮助页面,现在知道为什么无论是否存在 glmnet 结果都没有信息,那就是安装包的第一个参数不是包名而是库路径。我没有那个名字的库路径,所以在这两种情况下都没有找到包。