[R] How to include the documentation of a function in a Sweave document?
Henrique Dallazuanna
wwwhsd at gmail.com
Tue Feb 26 14:52:42 CET 2008
You can use '\include' also:
\documentclass{article}
\begin{document}
\include{/usr/local/lib/R/library/graphics/latex/plot}
%file.path(system.file(package="graphics"), "latex", "plot")
\end{document}
I don't know if there is a way of input file.path in include by Sweave.
On 25/02/2008, Jean lobry <lobry at biomserv.univ-lyon1.fr> wrote:
> Dear R-help,
>
> I would like to include the documentation of an R function in an
> *.rnw document processed by Sweave. Because I'm sharing my *.rnw
> files with colleagues under Linux and Windows (I'm on Mac OS X),
> I would like a pure R solution.
>
> The naive approach doesn't work, because Sweaving this *.rnw
> file:
>
> -------- tmp.rnw --------
> \documentclass{article}
> \begin{document}
> <<>>=
> ?plot
> @
> \end{document}
> -------- tmp.rnw --------
>
> yields the following LaTeX file on my platform (session info at the end):
>
> -------- tmp.tex --------
> \documentclass{article}
> \usepackage{/Library/Frameworks/R.framework/Resources/share/texmf/Sweave}
> \begin{document}
> \begin{Schunk}
> \begin{Sinput}
> > `?`(plot)
> \end{Sinput}
> \end{Schunk}
> \end{document}
> -------- tmp.tex --------
>
> in which no Soutput has been generated. Is it possible to redirect the
> help output, in a platform-independent way, so that it is included in
> the Soutput environment of the LaTeX file?
>
> Best,
>
> Jean
>
> > sessionInfo()
> R version 2.6.2 (2008-02-08)
> i386-apple-darwin8.10.1
>
> locale:
> C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] rcompgen_0.1-17
>
> --
> Jean R. Lobry (lobry at biomserv.univ-lyon1.fr)
> Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
> 43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
> allo : +33 472 43 27 56 fax : +33 472 43 13 88
> http://pbil.univ-lyon1.fr/members/lobry/
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list