I am trying to use tryCatch funciton to catch errors and stop runs with personalized and original error messages printed. The expression is to evaluate a+"T", which will surely produce an error. The code will be something like
a <- 1
res <- tryCatch({a+"T"},
error = function(e) {stop(); print("We get the following errors:"); print(Original_message)})
But this code doesn't work. How can we do all three things together?