[R] input line length in Sweave

From: Woodrow Setzer <wsetzer_at_mindspring.com>
Date: Wed 25 May 2005 - 06:23:31 EST

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

<<>>=

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

                            levels(AggData$sctn))]

@

This is translated in the tex file:

\begin{Sinput}
> BrainSections <- levels(AggData$sctn)[grep("(^BRAIN)|(^WHOLEBRAIN)|(LEFT HEMISPHERE)| (HALFBRAIN)", + levels(AggData$sctn))]
\end{Sinput}

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
<<>>=

options(width=66)

@

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed May 25 06:32:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:01 EST