[R] Concat two rows

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Tue Nov 30 09:36:14 CET 2010


have a look at function paste(), e.g.,

Dat <- data.frame(A = c("aaa", "bbb", "ccc", "ddd"),
     B = c(111, 222, 333, 444))

Dat$C <- paste(Dat$A, Dat$B, sep = ".")
Dat


I hope it helps.

Best,
Dimitris


On 11/30/2010 9:30 AM, alcesgabbo wrote:
>
> I have a table like this:
>
>
> A           B
> aaa       111
> bbb       222
> ccc       333
> ddd       444
>
> and I would like a new row C:
>
> A           B           C
> aaa       111      aaa.111
> bbb       222      bbb.222
> ccc       333      ccc.333
> ddd       444      ddd.444
>
>
> How can I do this
> ???
>
> Thanks
> Alberto
>

-- 
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/



More information about the R-help mailing list