I have an R For loop that downloads data from a server and adds result to table however, I sometimes get an error stopping the loop. If I tell it to redo the last download a
You could throw a try-catch combo.
for (i in 1:1000){
while(TRUE){
df <- try(downloadfnc("URL", file = i), silent=TRUE)
if(!is(df, 'try-error')) break
}
table[i,] <- df
}
This will continue within the while loop until the file is successfully downloaded, and only move on when it is successfully downloaded.