[R] Sweave - if \Sexpr{} than \SweaveInput{"my.Rnw"}
Yihui Xie
xie at yihui.name
Thu Sep 20 18:00:06 CEST 2012
If you want to program Sweave documents, you can try the knitr
package. This case will be something like:
<<>>=
paper <- TRUE # or change it to FALSE
@
<<child=if (paper) 'my1.Rnw' else 'my2.Rnw'>>=
@
i.e. you use the logical variable 'paper' to control which child
document to include in the parent document. See
http://yihui.name/knitr/
Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA
On Thu, Sep 20, 2012 at 7:47 AM, Witold E Wolski <wewolski at gmail.com> wrote:
> Depending on an R computation I would like to include an Sweave documents
> in the main Sweave document.
> How can I do it?
>
> So I was thinking .... to use Latex features :
>
> \newif\ifpaper
>
> \ifpaper
>
> \SweaveInput{"my1.Rnw"}
> \else
> \SweaveInput{"my2.Rnw"}
> \fi
>
> But how do I set paper to true or false given an \Sexpr ??
>
> \papertrue % or
>
> \paperfalse
>
>
> Any ideas?
>
>
> cheers
>
>
> --
> Witold Eryk Wolski
>
> Triemlistrasse 155
> 8047 Zuerich
More information about the R-help
mailing list