Re: [R] Sweave with external R code

From: Duncan Murdoch <>
Date: Thu, 24 Jun 2010 15:14:40 -0400

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 mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 24 Jun 2010 - 19:17:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jun 2010 - 19:40:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive