[R] Sweave : allowing errors in R code?

Tsjerk Wassenaar tsjerkw at gmail.com
Tue Aug 9 10:48:57 CEST 2011


Hi Remko,

The default behaviour of R upon encountering an error is to stop
execution of whatever is happening. To circumvent that, you have to
catch the error, using try, or you have to change the reaction of R to
errors, using 'options'. The help page for ?stop gives an explicit
example of the latter. There aren't any other flavours. The error
caught by try can still be printed, and you can modify the behaviour
of 'stop' to only print the error but not break.

Tsjerk

On Tue, Aug 9, 2011 at 9:22 AM, Remko Duursma <remkoduursma at gmail.com> wrote:
>> You can modify the behaviour upon errors by setting the error option. Check
>> ?option and ?stop
>
> I looked at the 'error' settings in ?options, but I am not sure how that
> would be helpful, since I am trying to avoid Sweave from halting after an
> error occurs. I still want the error to be printed, I just want Sweave to
> continue with the next code chunk.
>
> remko
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Sweave-allowing-errors-in-R-code-tp3728790p3729185.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands



More information about the R-help mailing list