I want to merge columns to create a new column:
x y z
1 A <NA> <NA>
2 <NA> B <NA>
49 <NA> <NA> C
50 <NA> <NA> C
I want the result:
x y z m
1 A <NA> <NA> A
2 <NA> B <NA> B
49 <NA> <NA> C C
50 <NA> <NA> C C
I checked previous answers, they were all based on summing rows using is.na but it cannot apply to this case where the variable is a character.