Dear members,
                          I have a function FUN1 that downloads some data from 
the internet. It so happens that the function doesn't work the first time, but 
on the second or third attempt it works. I want to run the function repeatedly 
for four times if it throws an error:

X <- tryCatch(FUN1, error = function(c) {FUN1})

This runs the function two times. But I want to run the function four times if 
throws an error, but on the fifth attempt if it throws an error, abort. I know 
I can include the tryCatch call inside FUN1 and call it, but any short and 
elegant code to that effect?

Thanking you,
Yours sincerely
AKSHAY M KULKARNI



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to