Skip to content
Prev 37427 / 63424 Next

Does anyone use Sweave (RweaveLatex) option "expand=FALSE"?

I picked the example from segmenting chromosomes for a reason.  I have a 
fair chunk of code that deals with not quite exceeding the amount of RAM 
available in the machine sitting on my desktop.  If I use functions, 
then the pass-by-value semantics of R will push me beyond the limits at 
some points.  (This is an empirical statement, not a theoretical one.  I 
was bitten by it several times while trying to analyze a couple of these 
datasets. And, yes, I know I can get around this by buying a bigger and 
better machine; it's on order...)  The real point is that using 
functions can be detrimental to the efficiency of the program, in ways 
that have real world consequences.

I haven't thought about doing the same thing with expressions. 
Expressions don't have quite the same semantics as chunks, and you'd 
have to make sure the evaluation was delayed so that you cold use the 
current values of things that were computed in the meantime.... and I 
already know how to do this with chunks without having to think so hard.

Using expressons would, however, help with the one difficulty that I 
have with reusing <<chunks>> (independent of whether or not I use 
'expand=FALSE').  I usually work inside emacs, using the 
emacs-speaks-statistics (ESS) package. ESS doesn't know how to evaluate 
the <<chunk>> call inside another chunk. so if I want to step through 
the code during development, I have to jump around myself to locate the 
source chunks.  With expressions that wouldn't matter.

As I ramble on about this, it occurs to me that the underlying issue is 
that <<chunks>> are not first class objects either in the LaTeX world or 
in the R world part of Sweave.  If there were a way to promote them to 
first class objects somehow, then it might make my use of ESS easier 
while simultaneously making it easier for Duncan to figure out how to 
report the correct line numbers.  But I only have an extremely vague 
idea of how one might start to do that...

    Kevin
Matt Shotwell wrote: