Skip to content

Instantly share code, notes, and snippets.

@leeper
Created June 19, 2015 21:07
Show Gist options
  • Save leeper/c41ea8c890a8b2474fa4 to your computer and use it in GitHub Desktop.
Save leeper/c41ea8c890a8b2474fa4 to your computer and use it in GitHub Desktop.
Install R-devel on Windows
# check for and remove previous R-devel install
g <- getwd()
setwd(R.home())
setwd("../")
if("R-devel") %in% dir()) {
setwd("R-devel")
shell.exec(dir()[grep("unin.+exe$", dir())])
## walk through uninstall dialog
setwd("../")
}
# download R-devel
tf <- file.path(tempdir(), "R-devel-win.exe")
d <- download.file("http://cran.r-project.org/bin/windows/base/R-devel-win.exe", tf, mode = "wb")
stopifnot(d == 0)
# run install wizard
shell.exec(tf)
## walk through install dialog
# copy packages from current install to r-devel
p <- c("devtools", "plyr", "knitr")
sapply(p, function(x) {
if(!dir.exists(file.path("R-devel", "library", x))) {
dir.create(file.path("R-devel", "library", x))
file.copy(file.path(R.home(), "library", x), file.path("R-devel", "library"), recursive = TRUE)
} else {
FALSE
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment