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

Duncan Murdoch murdoch.duncan at gmail.com
Fri Jun 3 02:48:44 CEST 2011


On 02/06/2011 5:03 PM, 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 suspect you are thinking of LaTeX or some other language; as far as I 
know there is no way to avoid including the break within a string in R 
source files.

There is one slightly ugly possibility if you are using Sweave:  put the 
source all on one line, but then post-process the output to wrap it.

Duncan Murdoch



More information about the R-help mailing list