[R] How to comment out entire code parts in Sweave files

Duncan Murdoch murdoch.duncan at gmail.com
Sat Sep 11 13:21:29 CEST 2010


On 11/09/2010 4:42 AM, Werner W. wrote:
> Hi,
> 
> I am wondering if there is any convenient way to comment out an entire region of 
> a Sweave file which comprises R and Latex code. Currently I'm doing it for the R 
> and Latex parts separately or transfer the unwanted part into a different file. 
> But both are not great solutions. (I am doing this when updating old files and 
> debugging)
> 
> Is there a way to do this with an equivalent of \iffalse \fi or is there some 
> "stop" command after which Sweave just stops processing?
> 

Prefixing each line with % should work, if you're starting in LateX mode.

Duncan Murdoch



More information about the R-help mailing list