[R] Help with try or tryCatch

David Scott
Mon, 31 Oct 2005 20:55:38 -0000

I am having trouble with try and tryCatch.

I have read the documentation but I just don't get it.

Here is what I am trying to do. I am testing a function which has a number
of parameters. I want to test it for different values of the parameters
and I have some loops, in the middle of which is a test of the function.
Sometimes the routine fails and so I have put the bit that might fail
inside try(). I would like to keep running through the loops when that
happens, but the whole computation stops. I have read in the documentation
about restarts and seen that there is a pre-established restart which
jumps to the top level, and I am guessing that that is what is happening.
What I can't see is how to get the computation to restart from the error
and just continue through the loop.

Any suggestions or pointers would be most welcome.

David Scott

_________________________________________________________________
David Scott	Department of Statistics, Tamaki Campus
 		The University of Auckland, PB 92019
 		Auckland	NEW ZEALAND
Phone: +64 9 373 7599 ext 86830		Fax: +64 9 373 7000
Email:	d.scott at auckland.ac.nz


Graduate Officer, Department of Statistics