I am trying to merge columns into one column, I've combined them using pmap
.
Some columns have NAs, I'd like to remove the NAs from the combined column col_comb
and leave the other values.
df = tribble(~id, ~col1, ~col2, ~col3,
1, "a", "b", "c",
2, "a", NA, "c",
3, "a", NA, NA,
4, NA, NA, NA)
df = df %>%
mutate(col_comb = pmap(list(col1,col2,col3), c))