result <- tryCatch({ # Code that may generate an error }, error = function(e) { # Code to handle the error }, finally = { # Code to be executed regardless of whether an error occurred })
result <- tryCatch({ # Code that may generate an error }, error = function(e) { # Code to handle the error }, finally = { # Code to be executed regardless of whether an error occurred })