Created
March 7, 2017 20:23
-
-
Save kylebaron/dc02fcfcdf9acc5757c20f317357ad6f to your computer and use it in GitHub Desktop.
A function to set path
This file contains 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
set_my_path <- function() { | |
FLAG <- "RTOOLS_WAS_SET" | |
rtools <- 'C:\\RBuildTools\\3.3\\bin;C:\\RBuildTools\\3.3\\gcc-4.6.3\\bin;' | |
if(Sys.getenv(FLAG)=="") { | |
message("setting your path") | |
Sys.setenv(PATH=paste0(rtools,Sys.getenv("PATH"))) | |
do.call(Sys.setenv,setNames(list("yes"),FLAG)) | |
} | |
if(!grepl(rtools,Sys.getenv("PATH"),fixed=TRUE)) { | |
stop("Your path does not include Rtools") | |
} | |
} | |
set_my_path() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment