Last active
December 15, 2015 02:59
-
-
Save jeffwong/5190817 to your computer and use it in GitHub Desktop.
Load an R object without overwriting things in the current workspace
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
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