[R] handling breaks in a for loop

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Sun Feb 6 19:55:43 CET 2022


dear members,
                         I have a very large for loop (basically a web scraping loop) with 500 iterations(over different stocks). I am concerned about the loop breaking midway.

My question is: is there any method to store the succesful iterations and continue with the iteration (ofcourse, after fixing the bug) where the exception occured? I can insert a save () function in the body of the loop and save the succesful iterations but this would slow down the execution speed. Any other method? I want to avoid trycatch as much as possible because an NA in the place of a succesful iteration would cost me much.

Thanking you,
Yours sincerely,
AKSHAY M KULKARNI

	[[alternative HTML version deleted]]



More information about the R-help mailing list