Skip to content

Instantly share code, notes, and snippets.

@air-drummer
Last active August 29, 2015 14:08
Show Gist options
  • Save air-drummer/044c945ce0b0af93eab0 to your computer and use it in GitHub Desktop.
Save air-drummer/044c945ce0b0af93eab0 to your computer and use it in GitHub Desktop.
Running chunks of R code in an arbitrary working directory
#Hadley: I use the following function to run chunks of R code in an arbitrary working directory.
run.in.dir <- function(dir, code) {
cur <- getwd()
setwd(dir)
on.exit(setwd(cur))
force(code)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment