Here is my code. It produces infinite loop, because value of something
variable does not change within captured error. Is it supposed to be this way? How can I fix it so that value of something
changes to FALSE
?
something <- TRUE
counter <- 1
while(something){
print(counter)
tryTest = tryCatch(
{
arima(rep(1,3), order = c(1,0,0))
},
warning = function(w) {
print('this is warning')
print(w)
},
error = function(e) {
something <- FALSE
print('this is error')
print(e)
},
finally = {}
)
counter <- (counter +1)
}