[R] Sweave and echoing R comments
Friedrich.Leisch at ci.tuwien.ac.at
Mon Jun 21 09:28:17 CEST 2004
>>>>> On Sun, 20 Jun 2004 20:34:50 +0000,
>>>>> Frank E Harrell (FEH) wrote:
> Charles H. Franklin wrote:
>> Is there any way to echo comments from an R source file into an
SWeave-> LaTeX document?
>> # Npop is population total
>> # Npoph0..Npoph2 are stratum totals
>> # Npoph is vector of stratum totals
>> In the final LaTeX document, I'd like the comments to be echoed so
>> readers other than me have guidance about variable names etc.
>> I suppose advocates of literate programming might argue that if the
>> comment is important it should be in the body of the .snw file, not
>> merely as R comments. Still... it seems easier to use brief comments in
>> the code itself and more explanatory text in the body of the document.
>> Searches of "Sweave" and "comment" in the list and documentation didn't
>> turn up anything about echoing comments in either R or Sweave.
> I agree that it would be nice to see comments in the output. I hope
> that Fritz Leisch will consider adding a hook that is a user-provided R
> function that take vectors of character strings representing a chunk of
> code and generating any desired LaTeX markup for pretty printing of the
> code. The function would return character vectors in LaTeX format. I
> like comments to appear in a smaller font, and for certain character
> translations, such as <- being replaced with a left arrow.
I agree that it would be nice, and it is on my list of things I want
to do over the summer ...
Institut für Statistik Tel: (+43 1) 58801 10715
Technische Universität Wien Fax: (+43 1) 58801 10798
Wiedner Hauptstraße 8-10/1071
A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
More information about the R-help