Dear R useRs,

after searching r-help and r-manuals for about one hour i have the following, probably easy question for you.

i have the following R-code, in the file test01.R

################################################################################

`fun1` <- function(x)
{
 x <- x + 2

 if(x == 5)
   stop("failure")

 return(x)
}

`fun2` <- function(x)
{
 x <- x + 4

 return(x)
}

x <- 1:10
val1 <- val2 <- numeric(10)

for(i in 1:10)
{
 val1[i] <- fun1(x[i])
}

for(i in 1:10)
{
 val2[i] <- fun2(x[i])
}

################################################################################

then i want to do

R CMD BATCH test01.R

the result file test01.Rout does not contain the computation of val2 and it stops in the for loop of val1.
how can i avoid this and continue the computation on error?

best regards

Andreas

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to