From kevin.r.coombes at gmail.com  Thu Aug 19 23:59:18 2010
From: kevin.r.coombes at gmail.com (Kevin Coombes)
Date: Thu, 19 Aug 2010 16:59:18 -0500
Subject: [Rd] Does anyone use Sweave (RweaveLatex) option "expand=FALSE"?
In-Reply-To: <4C6DA142.3090306@gmail.com>
References: <4C6D80E3.2090806@gmail.com> <4C6D9431.4020104@units.it>
	<4C6D9634.4030003@gmail.com> <4C6D9D26.9060505@gmail.com>
	<4C6DA142.3090306@gmail.com>
Message-ID: <4C6DA936.3030104@gmail.com>

I can certainly live with the line number matching some other part of 
the code.

Duncan Murdoch wrote:
> On 19/08/2010 5:07 PM, Kevin Coombes wrote:
>> I use it, frequently. The idea for it goes back to some of Knuth's 
>> original literate programming ideas for developing weave and tangle 
>> when he was writing TeX (the program).  I want to be able to document 
>> the pieces of some complex algorithm without having to see all of the 
>> gory details.  For instance, I have code that looks like the 
>> following.  (Note that this is typed on the fly rather than copied 
>> from actual source, so there may be typos.)
>
> Okay, thanks.  I'll keep it in.  So now I have a question:  suppose
> you have an error (syntax error at this point, maybe some other kinds 
> of error in the future) in the <<getInfoAboutThisSample>> chunk, but 
> that chunk wasn't eval'd, mainloop was eval'd.  So the error is going 
> to be reported as occurring in chunk mainloop, but with a line number 
> from somewhere else in the file.  Is that a problem?
>
> Duncan Murdoch
>
>
>>
>> <<mainloop,keep.source=TRUE,expand=FALSE>>=
>> for (i in 1:nSamples) {
>> <<getInfoAboutThisSample>>
>>  for (j in 1:nChromosomes) {
>> <<getChromosomeDataForCurrentSample>>
>> <<normalizeChromosomeData>>
>> <<findSegments>>
>> <<computeSignificance>>
>> <<writeResults>>
>>  }
>> }
>> @
>>
>> Each of the <<chunks>> is itself a fairly long piece of code defined 
>> and documented somewhere else.  (Some of them may themselves be 
>> written in the same form to reduce the final size of a chunk to 
>> something a human has a chance of understanding. That's the 
>> difference between weave and tangle in the original 
>> implementation.)   By blocking expansion, I can focus on the main 
>> steps without having them lost in pages and pages of code.
>>
>> So I vote strongly for retaining "expand=FALSE".
>>
>> Best,
>>     Kevin
>>
>> Duncan Murdoch wrote:
>>> On 19/08/2010 4:29 PM, Claudia Beleites wrote:
>>>> I never used it.
>>>>
>>>> I got curious, though. What would be a situation that benefits of 
>>>> this option?
>>>>   
>>> When I put it in, I thought it would be for people who were writing 
>>> about Sweave.
>>>
>>> Duncan Murdoch
>>>
>>>> Maybe a use case could be found by "brute force" (grep all .Rnw 
>>>> files on CRAN for the option?
>>>>
>>>> Claudia
>>>>
>>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Does anyone use Sweave (RweaveLatex) option "expand=FALSE"?
Kevin Coombes