Created
December 7, 2015 13:32
-
-
Save jlehtoma/f1b56f64cb3fa96f2876 to your computer and use it in GitHub Desktop.
Print warnings as they happen with a for-loop in R
This file contains hidden or 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
war <- function(x) { | |
suppressWarnings(w <- warning("There's a problem with: ", x)) | |
message(w) | |
return(x) | |
} | |
for (i in 1:5) { | |
Sys.sleep(1) | |
war(i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment