[R] can I paste 'newline'?
sunnyside500 at gmail.com
Fri Jul 20 19:42:47 CEST 2007
Thanks for replied from you all. I 've got better understanding of what
cat/paste does. what I am trying is to make FASTA format data. i.e. for each
line starting with '>', add '\n' at both ends while get rid of all '\n's for
e.g. this is original messy data, I need to remove newlines within the text
this is the first entry ('\n')
but here is extra newline('\n')
and also here that we need to remove.
this is the second entry, which is fine in format.
Of course, perl would be good at this, but I want to try with R for the
Duncan Murdoch-2 wrote:
> On 19/07/2007 7:41 PM, runner wrote:
>> It is ok to bury a reg expression '\n' when using 'cat', but not 'paste'.
>> 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
>> 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>
View this message in context: http://www.nabble.com/can-I-paste-%27newline%27--tf4114350.html#a11712720
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help