In a dataset, for example
data_frame(a=letters, a_1=letters, b=letters, b_1=letters)
I would like to combine columns with a similar "root", namely ac a_1and bc b_1. The result should look like
a b
<chr> <chr>
1 a a a a
2 b b b b
3 c c c c
4 d d d d
5 e e e e
6 f f f f
7 g g g g
8 h h h h
9 i i i i
10 j j j j
source
share