From friedrich.leisch at stat.uni-muenchen.de  Mon Dec  3 10:18:56 2007
From: friedrich.leisch at stat.uni-muenchen.de (friedrich.leisch at stat.uni-muenchen.de)
Date: Mon, 3 Dec 2007 10:18:56 +0100
Subject: [Rd] [R] Sweave: Variables in code chunk headers
In-Reply-To: <fiv1or$qfs$1@ger.gmane.org>
References: <fis1g7$65a$1@ger.gmane.org>
	<loom.20071201T171543-701@post.gmane.org>
	<fisd7m$85f$1@ger.gmane.org> <4751CA79.6060507@stats.uwo.ca>
	<fit2oq$ujf$1@ger.gmane.org> <47529A15.3000100@stats.uwo.ca>
	<fiv1or$qfs$1@ger.gmane.org>
Message-ID: <18259.51712.43960.315718@lxh5.stat.uni-muenchen.de>

>>>>> On Sun, 02 Dec 2007 19:41:04 +0000,
>>>>> Michael Hoffman (MH) wrote:

  > Duncan Murdoch wrote:
  >> I put together a clunky way to handle that for a presentation last week; 
  >> it may be enough for you.
  >> 
  >> I leave the Sweave options at their defaults, but I have code chunks 
  >> that affect the appearance, and I run those without echoing to switch 
  >> between a couple of formats.  For example, I have some pages that 
  >> display one figure, and others that display two.

  > That is a decent way of doing what I am suggesting. Probably too 
  > complicated to be worth it if I am just changing one variable.

  >> One other thing that would have helped with this approach would be a way 
  >> to include another file:  then I wouldn't have to repeat those 
  >> definitions in every Rnw of the project.

  > Yet another candidate for (yet another) pre-processing step. :)

  > Of course, you could load the complicated bits in another file with 
  > source(). You'd still have to redefine <<single>> and <<double>> 
  > everywhere, but at least you would be able to change the option settings 
  > easily. Like this:

  > <<echo=F>>
  > source("init.R")
  > @

  > <<single, echo=F, eval=F>>=
  > setup.single() # loaded from init.R
  > @

Why do threads on Sweave always seem to happen when I am offline? ;-)

Sorry to join in late, but my excuse is rather good: A plane over
Siberia isn't exactly email-territory yet (at least in economy
class): I was in transit from Munich to Tokio for most of the last 20
hours.

I do have untested code which evaluates options rather than statically
processing them, but I don't want to commit that in my current state
of mind (and I know that it needs another round of testing). I'm also
not sure how good my internet connectivity will be for the rest of the
week -> next week at the latest. Perhaps I can also include Max'
suggestion of default settings via options() & styles a la odfWeave.

Best,
Fritz



[Rd] [R] Sweave: Variables in code chunk headers
friedrich.leisch at stat.uni-muenchen.de