[R] Sweave line length
Duncan Murdoch
murdoch at stats.uwo.ca
Tue Oct 30 14:22:19 CET 2007
On 10/30/2007 8:55 AM, Kevin E. Thorpe wrote:
> Keith Jones wrote:
>> Hello,
>>
>> I am trying to add R code to my dissertation and the length of a line
>> of text that Sweave generates is longer than the right margin in my
>> dissertation. I have found no way to tell Sweave how to set the line
>> length. I am using an iMac with tiger ver. 10.4.10, and R: ver.
>> 2.5.1. Here is the R code that is longer than my right margin:
>>
>> input to Sweave:
>> legend("topleft",c("obs", "theo","hi","lo"),lty =
>> c(1,2,3,4),col=c(1,2,6,4,0), cex=1.5,pt.cex=c(3,6), bty='o',inset=.05)
>>
>> output from Sweave:
>>> legend("topleft", c("obs", "theo", "hi", "lo"), lty = c(1, 2, 3,
>>> 4), col = c(1,
>> + 2, 6, 4, 0), cex = 1.5, pt.cex = c(3, 6), bty = "o", inset = 0.05)
>>
>> The line is about eleven (11) characters too long.
>>
>> Thanks,
>>
>> Keith Jones
>>
>
> I'm not sure if it affects the echoed commands too, but inserting a code
> chunk like
>
> <<>>
> options(width=60)
> @
>
> (replace 60 with the width you need) controls the width of the R output.
You can also set keep.source=TRUE as an Sweave option, in which case the
formatting of R code will match what you have in your source file.
Duncan Murdoch
More information about the R-help
mailing list