Created
June 10, 2017 14:32
-
-
Save msuzen/d25f7e729198b351fd5f2a3abc024d2b to your computer and use it in GitHub Desktop.
Simple try/catch in R
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
R Notes: | |
# tryCath Example | |
# http://stackoverflow.com/questions/12193779/how-to-write-trycatch-in-r | |
out <- tryCatch({ | |
pp <- find.package(packageName,lib.loc=lib.loc), | |
}, | |
error=function(cond) { | |
cat("packageName or lib.loc in ", | |
"packageRSubdirectoryLinesOfCode", | |
"does not seem to exist \n") | |
return(NULL) | |
}, | |
warning=function(cond) { | |
cat("packageName or lib.loc in ", | |
"packageRSubdirectoryLinesOfCode", | |
"does not seem to exist \n") | |
return(NULL) | |
}, | |
finally={} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment