Re: [R] R-code in R-file documentation

2011-05-18 Thread Yihui Xie
I guess what you want is cat(readLines("file.r"), sep = "\n") Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Wed, May 18, 2011 at 4:03 AM, Brian Oney wrote: > Hello List, > I would like to

Re: [R] R-code in R-file documentation

2011-05-18 Thread Ben Bolker
Brian Oney gmail.com> writes: > > Hello List, > I would like to insert code from .r files into a LaTeX appendix > (possibly using Sweave). > I was considering: > [snip] Wouldn't it be easier to use the LaTeX listings package?

[R] R-code in R-file documentation

2011-05-18 Thread Brian Oney
Hello List, I would like to insert code from .r files into a LaTeX appendix (possibly using Sweave). I was considering: <>= source("file.r") @ but I would just like to echo the code and not evaluate the code within the file. maybe: <>= cat("\\begin{verbatim}") readLines("file.r") cat("\\end{v