Last active
August 29, 2015 14:14
-
-
Save datalove/b2a0bcd4c434fc0b5341 to your computer and use it in GitHub Desktop.
How to create a local package repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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