Let me tell you that R basically executes the functions for implementing try-catch block:
The syntax of that function looks like the following code:
result = tryCatch({
expr
}, warning = function(warning_condition) {
warning-handler-code
}, error = function(error_condition) {
error-handler-code
}, finally={
cleanup-code
})
In tryCatch() there are in all two ‘conditions’ that can be handled. The conditions are ‘warnings’ and ‘errors’. Note that you have to write each block of code is the state of execution and the scope. If you are a beginner and want to know more about R then do check out the R programming tutorial.