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

来源:互联网 发布:xy苹果手机助手mac版 编辑:程序博客网 时间:2024/05/18 12:33

安装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@masterfrom URL https://api.github.com/repos/IRkernel/IRdisplay/zipball/masterInstalling IRdisplayError 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:
  • https://github.com/IRkernel/IRkernel/issues/378
  • https://github.com/talgalili/installr
  • https://www.digitalocean.com/community/tutorials/how-to-set-up-r-on-ubuntu-14-04 *
  • https://www.r-statistics.com/tag/installr/
0 0
原创粉丝点击