Skip to content

Instantly share code, notes, and snippets.

@Dulani
Last active August 29, 2015 14:08
Show Gist options
  • Save Dulani/aef1a6ba9b075eae533e to your computer and use it in GitHub Desktop.
Save Dulani/aef1a6ba9b075eae533e to your computer and use it in GitHub Desktop.
R: A working example with tryCatch() that takes action on bad data and then throws a warning.
parsedXml <- tryCatch( ParseAlert(xmlParse(alert.xml)),
error = function(e){ warning(paste("Problem encountered parsing alert XML for:",curMsgID,continuing));
warning(geterrmessage());
data.frame(NA)
return(NA)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment