Skip to content

Instantly share code, notes, and snippets.

@atajti
Created December 23, 2016 22:05
Show Gist options
  • Save atajti/7c2a37ad37ef3fae900b98cd904e0f99 to your computer and use it in GitHub Desktop.
Save atajti/7c2a37ad37ef3fae900b98cd904e0f99 to your computer and use it in GitHub Desktop.
get the running R script's directory
get_script_dir <- function(){
ca <- commandArgs()
script_path <- gsub("--file=", "",
ca[grepl("--file=", ca)])
return(dirname(script_path))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment