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

Rolf Turner rolf.turner at xtra.co.nz
Fri Jun 3 01:41:54 CEST 2011


On 03/06/11 10:16, Peter Langfelder wrote:
> 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")

Absolutely not!  Did you *read* the OP's question?  He wants to break
the line in the code --- for readable code presumably --- but ***not***
in the output!   Your advice is the antithesis of what is required.

     cheers,

         Rolf Turner



More information about the R-help mailing list