How to merge this into 1 column?
df <- data.frame(a = c("1", "2", NA, NA), b = c(NA, NA, "3", "4"), c = c(NA, "5", "6", NA), stringsAsFactors = F)
I just want to get All values from b into a without NA. So a should be: "1", "2", "3", "4". (Now is the need of choosing columns from more than 2 in df)
This works not good:
df$a <- df$b[!is.na(df$b)]