[R] can I paste 'newline'?
Duncan Murdoch
murdoch at stats.uwo.ca
Fri Jul 20 01:51:09 CEST 2007
On 19/07/2007 7:41 PM, runner wrote:
> It is ok to bury a reg expression '\n' when using 'cat', but not 'paste'.
> e.g.
>
> cat ('I need to move on to a new line', '\n', 'at here') # change line!
> paste ('I need to move on to a new line', '\n', 'at here') # '\n' is just a
> character as it is.
>
> Is there a way around pasting '\n' ? Thanks a lot.
What do you want to get? Do you want a two element vector? Then use
c(). Do you want a one element vector that prints on two lines? Use
either form, they both work (but you need to use cat() to do the display).
> x <- paste ('I need to move on to a new line', '\n', 'at here')
> cat(x)
I need to move on to a new line
at here>
More information about the R-help
mailing list