0

can anyone tell me which command I need to do this? Lets say's this is my data:

the first one with variables X1 and X2

And I want to make variable X1X2 out of it.

So, I want the numeric codes to be placed next to each other, and not summarized or any other mathematical function. Can someone help me?

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
Hannah1
  • 11
  • 1
  • 2
    Does this answer your question? [Concatenating two text columns in dplyr](https://stackoverflow.com/questions/50845474/concatenating-two-text-columns-in-dplyr) – Ravi Saroch Oct 29 '20 at 10:24

1 Answers1

1

Is this helpful to you......

df1 <- read.table(header=TRUE, text="
     X1   X2
     1    3
     2    7
     4    5
     5    9
     3    1
     ")

df1$xa1x2 = paste0(df1$X1,df1$X2)
Ravi Saroch
  • 934
  • 2
  • 13
  • 28