Skip to content

Instantly share code, notes, and snippets.

@datalove
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save datalove/b2a0bcd4c434fc0b5341 to your computer and use it in GitHub Desktop.

Select an option

Save datalove/b2a0bcd4c434fc0b5341 to your computer and use it in GitHub Desktop.
How to create a local package repo
files <- list.files("C:/R/packages", pattern = "^MYPACKAGENAME.*\\.zip", full.names = TRUE)
files <- gsub("-([0-9]{1})\\.","-0\\1\\.", files)
files
latest_file <- sort(files, decreasing = TRUE)[1]
latest_file
dest <- "\\\\intranet.mycompany.org/INTRANET/Shared/R/bin/windows/contrib/3.0"
copy_success <- file.copy(latest_file, dest)
copy_success
if (copy_success)
tools::write_PACKAGES(dir = dest, type = "win.binary", verbose = T, addFiles = T)
rm(list=ls())
# now don't forget to add this to Rprofile.site file under R-X.XX.X/etc
# options(repos = c(getOption("repos"), MyRepoName = "file:\\\\intranet.mycompany.org/INTRANET/Shared/R")) # MyRepoName can be anything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment