0

Hi Guys I'm fairly new to R and tried to look at past examples of tryCatch and I was sadly not able to understand it and apply it to my problem.

So I have the following code

for(i in context.stocks){


  B = as.zoo(av_get(symbol = i, av_fun = "TIME_SERIES_INTRADAY", interval = "1min", outputsize = "full"))
  A =merge.zoo(A,B)

Where context.stocks is a large list (497 values) of tickers, some of which cause errors with the data-call and I'd like the loop to continue even if there is an error with one of the tickers.

Thank you very much for your help!

  • 1
    Try this: https://stackoverflow.com/questions/12193779/how-to-write-trycatch-in-r it is really well described – storaged Dec 09 '17 at 14:21
  • If you also want to think about just a `try()` rather than `tryCatch()`, see [this passage](http://adv-r.had.co.nz/Exceptions-Debugging.html#condition-handling) in Hadley Wickham's Advanced R book or [this related SO question](https://stackoverflow.com/questions/44416163/try-try-catch-function-in-r). – duckmayr Dec 09 '17 at 14:30
  • Thanks a lot, I will have a look at it. – Tirseco Dec 10 '17 at 12:38

0 Answers0