What? Where? When?
These are key questions that every scientist or other collector of environmental data must answer.
- What is the value of the thing we are measuring?
- Where are we taking the measurement?
- When are we taking the measurement?
In a previous post we discussed how to standardize “when”. But what about “where”?
In a previous post, we looked at error handling in R with the
tryCatch() function and how this could be used to write Java style try-catch-finally blocks. This time we’ll look at what can be done with the
try() function and how we can easily process warning and error messages to take appropriate action when something goes wrong.
The R language definition section on Exception Handling describes a very few basics about exceptions in R but is of little use to anyone trying to write robust code that can recover gracefully in the face of errors. In fact, if you do a little searching you will find that quite a few people have read through the
?tryCatch documentation but come away just as confused as when they started. In this post we’ll try to clarify a few things and describe how R’s error handling functions can be used to write code that functions similarly to Java’s try-catch-finally construct.