[R] input line length in Sweave

Woodrow Setzer wsetzer at mindspring.com
Tue May 24 22:23:31 CEST 2005

I am having trouble in Sweave with input line lengths.  For example, I may have in my input file the chunk

BrainSections <-


This is translated in the tex file:

> BrainSections <- levels(AggData$sctn)[grep("(^BRAIN)|(^WHOLEBRAIN)|(LEFT HEMISPHERE)| (HALFBRAIN)", 
+     levels(AggData$sctn))]

The problem is that the line produced is too long.  I read the answer to the Sweave FAQ question 13 (How can I change the line length of S input and output?) to mean that options(width) controls both input and output; however, the first code chunk in the above example contains 


Is there a way to get Sweave to wrap long input lines better, or get it to use my own formatting of the input?  I realize I can edit the output tex file, but that is impractical in my application (too many).

I am using R version 2.0.1 Patched (2005-01-26) on a Linux system (so, I suppose one possible answer is that this is fixed in 2.1.0; I cannot switch right now).

Woodrow Setzer
National Center for Computational Toxicology
US Environmental Protection Agency
Research Triangle Park, NC 27711

More information about the R-help mailing list