ubuntu下使用github安装R Packages[已解决]

安装packages失败:
提示错误为:

package ‘****’ is not available (for R version 3.1.2) 
Solved:
使用github的安装方式:
  1. 先安装好devtools:
    * Installing devtools Package *
    While many R packages are hosted on CRAN and can be installed using the built-in install.packages() function, there are many more packages that are hosted on GitHub but are not on CRAN. To install R packages from GitHub, we need to use the devtools R package, so let’s install it.

The devtools R package requires three system packages to be installed on the Droplet, namely libcurl4-gnutls-dev, libxml2-dev, and libssl-devc. Install these three packages:

$ sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev

Now the devtools R package can be installed. Remember that we want to install it using the same method as described above, rather than install it within an R session, because devtools should be available to all users.

R > install.packages('devtools', repos='http://cran.rstudio.com/')
  1. 碰见问题:
> devtools::install_github(c('IRkernel/IRdisplay', 'IRkernel/IRkernel'))
Downloading GitHub repo IRkernel/IRdisplay@master
from URL https://api.github.com/repos/IRkernel/IRdisplay/zipball/master
Installing IRdisplay
Error in if (capabilities("libcurl")) { : argument is of length zero
解决方式:
$ sudo apt-get install libcurl4-openssl-dev libxml2-dev libxslt-dev libssl-dev -y
$ sudo apt-get install r-base r-base-dev -y
$ R
...
> options(repos='http://cran.rstudio.com/')
> install.packages("devtools")
> install.packages(c('repr', 'pbdZMQ', 'devtools'))
> options(download.file.method = "wget")
> install.packages('RCurl')
> devtools::install_github(c('IRkernel/IRdisplay', 'IRkernel/IRkernel'))
> IRkernel::installspec()

3.安装packages: 比如installr

if (!require('devtools')) install.packages('devtools'); # make sure you have Rtools installed first! if not, then run:
#install.packages('installr')
#install.Rtools()
devtools::install_github('talgalili/installr')
Ref:
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值