apparently try and trycatch do not work for this problem! Any alternative solutions?
i'm trying to make the following example code work without actually changing any code
result = 0
for(i in 1:10){
result = result + i
log("a") #I do not care about this error
result = result + i
}
This should give result = 110
If i actually do it manually by copying the part inside the loop and increasing the counter it works perfectly:
result = 0
#iteration 1
i = 1
result = result + i
log("a")
result = result + i
#iteration 2
i = i+1
result = result + i
log("a")
result = result + i
#iteration 3
i = i+1
result = result + i
log("a")
result = result + i
#etc.
However my real code has about 1000 lines and needs to loop a few hundred times.
So i'd like to have some option
options(on.error.just.continue.the.next.line) = TRUE
I've read about try/tryCatch but I don't understand it correctly I think