I'm not really understanding how tryCatch
works. Especially the last part where you store your error message. There are a lot of posts on Stackoverflow about how to use tryCatch
, but the solutions generally just post an error message and then move on. I'd like to store the indices of the for loop where the errors occurred so I can go back to them easily later. I'm thinking about something as follows using tryCatch
flag = NULL
for(i in 1:10) {
do something that can cause an error
if (error occurs) flag=c(flag,i) and move on to the next iteration
}
Ideally I'd like flag
to store the indices during the errors.