Is there any way to echo comments from an R source file into an SWeave->LaTeX document?

Example:

# Npop is population total
# Npoph0..Npoph2 are stratum totals
# Npoph is vector of stratum totals

Npop<-sum(to2000)

Npoph0<-sum(to2000[bg==0])
Npoph1<-sum(to2000[bg==1])
Npoph2<-sum(to2000[bg==2])

Npoph<-c(Npoph0,Npoph1,Npoph2)



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.


Thanks.

Charles

--

Charles H. Franklin
Professor, Political Science
University of Wisconsin, Madison
608-263-2022
[EMAIL PROTECTED]
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to