Displaying 1 result from an estimated 1 matches for "the_x".
Did you mean:
the_
2008 Jul 21
1
Howto Restart A Function with Try-Error Catch
...do is the following:
1. Catch the try-error using class.
2. Redo the function if it returns "try-error"
3. Otherwise keep the output of the function.
I'm not sure how to create the above construct.
The code I have below doesn't work:
__BEGIN__
myfunction <- function(the_x) {
# do something
a = list(output1=val1, output2 = val2)
a
}
out <- try(suppressWarnings(myfunction(x)),silent=T)
if (class(out) == "try-error") {
#this clause doesn't seem to "redo"
out <- myfunction(X)...