[R] paste command with new line separator

slurpy sunayan at gmail.com
Mon Nov 17 21:03:07 CET 2008


Win xp sp2, R v2.7.1
Hi.  If I have two numeric columns in a data frame, I can use the paste
command to combine them into a new column separated by a comma.
c3=paste(c1,c2,sep=',')
gives: 1 1 -> "1,1"
Is there any way I can use a new line (\n) as a separator?
i.e.
1 1 -> 1
         1
I tried paste(1,1,'\n') but it only gives "1\n1"
Is there any other command for this? I tried cat but it doesn't work for
columns.
Sorry if its already answered somewhere else, but I couldn't find it.
Thanks.
-- 
View this message in context: http://www.nabble.com/paste-command-with-new-line-separator-tp20546923p20546923.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list