Le mar. 25 mars ? 17:12, Christophe Genolini a ?crit :
> Hi the list.
>
> I am writing a tutorial for my student using LaTeX and sweave. I
> include
> some example that work (obiously) but I would also like to include
> some
> example that do NOT work (for pedagogie)...
> Is it possible ?
>
> At this point, I find that :
> - if there is a error in the code, Sweave stop
> - if I put the error in try(), Sweave compile but does not print the
> error as output.
>
> Any solution ?
>
> Thanks a lot
>
> Christophe
Something along these lines should do what you want:
<<echo=TRUE, eval=FALSE>>TRUE <- 3
@
<<echo=FALSE, eval=TRUE>>cat(try(TRUE <- 3))
@
If I recall correctly, this was discussed here before.
HTH
---
Vincent Goulet, Associate Professor
?cole d'actuariat
Universit? Laval, Qu?bec
Vincent.Goulet at act.ulaval.ca http://vgoulet.act.ulaval.ca