[R] Sweave with external R code

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jun 24 21:14:40 CEST 2010


On 24/06/2010 3:00 PM, Gaston Fiore wrote:
> Hello,
>
> I'm new to R and Sweave and I was wondering whether you can just include all your R code in external files and then call them from within the code chunks. I've read the Sweave User Manual but I couldn't find any specific information about this. Is this not customarily done?

Normally the idea is that the Sweave document is self-contained, so you 
wouldn't do this.  However, you would often put a lot of your code into 
a package, and then attach the package early in the Sweave document.  
It's also possible to use source() in a code chunk.

Duncan Murdoch



More information about the R-help mailing list