I would like to use sys.sleep function when the request of an API I am using gives me an error back. Like this one:
Error in open.connection(con, "rb") : HTTP error 429.
Should I use trycatch?
data<- fromJSON("https://api.com")
Thanks !
You can use try catch
tryCatch(myfunc(), error=function(e) Sys.sleep(1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With