I have a table read in R as follows:
column1 column2
A B
What is the command to be used to match two columns together as follows?
Column 3
A_B
I have a table read in R as follows:
column1 column2
A B
What is the command to be used to match two columns together as follows?
Column 3
A_B
My personal favourite involves making use of the
unite
intidyr
:Results
Side notes
Personally, I find the
remove = TRUE / FALSE
functionality of unite very useful. In additiontidyr
firs thedplyr
workflow very well and plays well withseparate
in case you change your mind about the columns being merged. On the same lines, ifNA
s are the problem introducingna.omit
to your workflow would enable you to conveniently drop the undesirable rows before creating the desired column.I'm a bit unsure what you mean by "merge", but is this what you mean?
Or equivalently, as @daroczig points out: