I'm joining the following two tibbles using full_join
:
library(dplyr)
library(tibble)
tibble(id=c(1:2, NA), b = c("mouse", "cat", "fish"), c = 6:8) %>%
full_join(tibble(id=1:3, b = c("mouse", "", "fish"), c = 6:8))
This will give me:
A tibble: 5 x 3
id b c
1 mouse 6
2 cat 7
NA fish 8
2 7
3 fish 8
Ideally though, I would like to get something like that:
A tibble: 5 x 3
id b c
1 mouse 6
2 cat 7
3 fish 8
Where all NAs or missing values are being replaced by a more "superior" row that has more information. How can I do this?