红联Linux门户
Linux帮助

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

发布时间:2016-10-15 11:41:02来源:linux网站作者:教育数据挖掘小小子
安装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/')
 
2.碰见问题:
> 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')
 
本文永久更新地址:http://www.linuxdiyf.com/linux/25072.html