I\'m a huge fan of tryCatch(). However, until today I never really paid attention to the distinction between simple and regular warnings/errors and thus I don\'
You can recall the forecast within the warning section, something like this:
mod <- tryCatch(
out <- forecast::auto.arima(x=y),
error=function(e) {
print(e)
},
warning=function(w) {
print(w)
out <- forecast::auto.arima(x=y)
return(out)
}
)
This will print a warning , but the result of forecast is stored in mod now.
> mod
Series: y
ARIMA(4,1,1)
Coefficients:
ar1 ar2 ar3 ar4 ma1
0.6768 -0.2142 0.5025 -0.7125 -0.8277
s.e. 0.0749 0.0889 0.0874 0.0735 0.0485
sigma^2 estimated as 915556: log likelihood=-780.33
AIC=1572.65 AICc=1573.62 BIC=1587.91