Say I have two dataframes:
a <- data.frame(id = 1:5, nom = c("a", "b", "c", "d", "e"))
b <- data.frame(id = 3:1, nom = c("C", "B", "A"))
and i would like to join the two dataframes such that it still has two columns (id
and nom
) but where id = 4
and id = 5
the nom
column retains the d
and e
values respectively. How do I achieve this? the solution I'd like looks like this:
Essentially, I'd like to avoid the NA output and retain the old rows where a left join match does not exist.