[R] Use line break at scrip but avoid line break on graphics

Peter Langfelder peter.langfelder at gmail.com
Fri Jun 3 00:16:24 CEST 2011


On Thu, Jun 2, 2011 at 3:13 PM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
> On 03/06/11 09:03, Walmes Zeviani wrote:
>>
>> Hello list,
>>
>> I have plots with long strings in main=, ylab= or xlab=. So, in I my
>> script
>> I use break long lines to avoid lines hiden on my monitor and in sweave
>> document pages. I use graphics like this
>>
>> plot(1, main="aaaaaaaaaaaaaaaaaaaa
>>               bbbbbbbbbbbbbbbbbbbb")
>>
>> but I would like a plot result like this
>>
>> plot(1, main="aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb")
>>
>> I remember once I saw a meta character like "\n" that avoid this breack
>> line
>>
>> plot(1, main="aaaaaaaaaaaaaaaaaaaa\(?)
>>               bbbbbbbbbbbbbbbbbbbb")
>>
>> Does someone know that?
>
> I think that
>
>    plot(1,main=paste("aaaaaaaaaaaaaaaaaaaa",
>                                   "bbbbbbbbbbbbbbbbbbbb"))
>
> might do what you want.

I think he needs

plot(1,main=paste("aaaaaaaaaaaaaaaaaaaa\n",
                                 "bbbbbbbbbbbbbbbbbbbb", sep = ""))

or simply

plot(1, main="aaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbb")

Peter



More information about the R-help mailing list