Skip to content

Instantly share code, notes, and snippets.

@jeffwong
Last active December 15, 2015 02:59
Show Gist options
  • Save jeffwong/5190817 to your computer and use it in GitHub Desktop.
Save jeffwong/5190817 to your computer and use it in GitHub Desktop.
Load an R object without overwriting things in the current workspace
myload = function(filename) {
tryCatch({
local({
objects = load(filename)
if (length(objects) == 1) return (get(objects))
else return (lapply(sapply, get))
})
}, error = function(e) {cat("No such file")})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment