Re: [R] Joining variables

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Thu 25 May 2006 - 04:51:53 EST

On Wed, 2006-05-24 at 14:45 -0400, Guenther, Cameron wrote:
> Hello,
>
> If I have two variables that are factors or characters and I want to
> create a new variable that is the combination of both what function can
> I use to accomplish this?
>
> Ex.
>
> Var1 Var2
> SA100055113 19851113
>
> And I want
>
> NewVar
> SA10005511319851113
>
> Thanks in advance.

See ?paste and note the 'sep' argument:

> NewVar <- paste(Var1, Var2, sep = "")

> NewVar

[1] "SA10005511319851113"

HTH, Marc Schwartz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 25 05:09:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 May 2006 - 06:10:26 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.