I might try something like this:
FUN1 <- function ()
{
threshold <- 4L
fails <- 0L
internal <- function() {
## do the actual downloading here
tryCatch({
download.file(<...>)
}, error = function() {
fails <<- fails + 1L
if (fai
Dear Iris,
THanks a lot...
Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
From: Iris Simmons
Sent: Wednesday, April 19, 2023 11:22 PM
To: akshay kulkarni
Cc: R help Mailing list
Subject: Re: [R] running a function repeatedly on error
I
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 <- t
3 matches
Mail list logo