[R] Sweave : allowing errors in R code?
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Tue Aug 9 12:11:49 CEST 2011
Dear Remko,
Here is a working example on what Duncan suggested.
Best regards,
Thierry
<<echo = TRUE, eval = TRUE>>=
TheObject <- "Something"
ls()
rm("TheObject")
@
%outputs the R code but does not execute it. So no error
<<echo=TRUE, eval=FALSE>>=
TheObject
@
% executes the code but displays only the error
<<echo=FALSE, eval=TRUE>>=
cat(try(TheObject))
@
> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
> Namens Remko Duursma
> Verzonden: dinsdag 9 augustus 2011 9:23
> Aan: r-help op r-project.org
> Onderwerp: Re: [R] Sweave : allowing errors in R code?
>
> > 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 op 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.
More information about the R-help
mailing list