如何安装R包github存储库的开发版本

时间:2012-03-11 14:58:49

标签: r github ggplot2

如何直接从github存储库安装正在开发的软件包,一旦安装,如何在开发和CRAN版本之间切换?

我有兴趣从git安装的特定包是ggplot2。

4 个答案:

答案 0 :(得分:79)

来自哈德利https://github.com/hadley/ggplot2

install.packages("devtools")

library(devtools)

dev_mode(on=T)

install_github("hadley/ggplot2")

# use dev ggplot2 now

# when finished do:

dev_mode(on=F)  #and you are back to having stable ggplot2

答案 1 :(得分:18)

我觉得之前的两个答案都错过了你的问题。

考虑一下:

  • 您可以通过R CMD INSTALL(通过-l)和install.packages()的参数控制安装位置包。

  • 在运行时,您可以通过.libPaths()控制加载软件包的位置。

因此,只需在.Rprofile(或类似)中设置一些变量即可控制此变量。

答案 2 :(得分:3)

用于编译二进制文件安装:

install.packages('xxx', repo='http://repo_adress')

用于源安装:

install.packages('xxx', repo='http://repo_adress', type='source')

答案 3 :(得分:0)

devtools::install_github("ggplot2")