if (FALSE) {
if (!file.exists("some.file")) {
cat("Error: some.file does not exist.\n", file = stderr())
sys.exit(1)
} else if (Sys.getenv("IMPORTANT_ENV") == "") {
cat("Error: IMPORTANT_ENV not set.\n", file = stderr())
sys.exit(2)
} else {
cat("Everything good. Starting calculations...")
# ...
cat("Finished with success!")
sys.exit(0)
}
}
Run the code above in your browser using DataLab