Dear all,
Let's say I have this script , below. tryCatch indeed catches the error but
exists, I want function to continue and stay in the loop. I found very
examples of withRestarts on internet to figure it out. Could you help me how to
do it ?
myfunc <- function()
{
while(1)
{
x <- runif(1)
if ( x > 0.3 ) a <- x/2 else a <- x/"b"
print(a)
Sys.sleep(1)
}
}
tryCatch({ myfunc() },
warning = function(w) { print("warning") },
error = function(e) { print("error") },
finally = { print("end") }
)
______________________________________________
[email protected] 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.