[Rd] [R] Sweave: Variables in code chunk headers
friedrich.leisch at stat.uni-muenchen.de
friedrich.leisch at stat.uni-muenchen.de
Mon Dec 3 10:18:56 CET 2007
>>>>> 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
More information about the R-devel
mailing list