Skip to content
Prev 239009 / 398500 Next

Combining the values of two variables into one

On Oct 22, 2010, at 4:14 PM, Marc Schwartz wrote:

            
David,

It occurs to me that my solution may not be correct, depending upon what your real source data are.

For example:

v1 <- c(12, 34)

v2 <- (56, 78)
[1] 176 418

Does not of course get you:

  c(1256, 3478)

If that is what you actually want in that scenario, use:
[1] 1256 3478

That also works for your original data:

v1<-c(1,3,5,7)
v2<-c(2,4,6,8)
[1] 12 34 56 78


See ?paste, which returns a character vector, which you then coerce to numeric.

HTH,

Marc