I want to ask, how can I make a new column in a data.frame in R by merging 2 columns (with categorical values) with all rows in the file. Following example is showing alternate categorical conditions in column_1
and column_2
how could I make column_3
by merging columns_1
and column_2
? Moreover, in 4th row both columns have values, so in this case what would be in column_3
. (NA
are blanks).
Column_1 Column_2 Column_3
1 NA
NA 2
2 NA
NA 1
1 2