I have 2 columns of data (x1, x2) and they have common and dissimilar data. I want to paste the the 2 columns together, separate by + sign, to a new variable (x3) so the data is in order i.e. the lowest numbered/character element always appears before the separator (+). For example this is what I want
ID x1 x2 x3
01 x*01:02 x*01:03 x*01:02+x*01:03
02 x*01:03 x*01:02 x*01:02+x*01:03
03 x*02:01 x*08:01 x*02:01+x*08:01
04 x*08:01 x*02:01 x*02:01+x*08:01
when i run
df$x3 = paste(df$x1, df$x2, sep="+")
x3 for IDs 01 to 01 appears as
x3
x*01:02+x*01:03
x*01:03+x*01:02
x*02:01+x*08:01
x*08:01+x*02:01