I\'m trying to do a Last Observation Carried Forward operation on some poorly formatted data using dplyr
and tidyr
. It isn\'t working as I\'d expe
Two questions, does it has be duplicated and do you have to use dplyr
and tidyr
?
Maybe this could be a solution?
(
bar <- data.frame(id=c(1,1,2,2,3,3),
email=c('bob@email.com', NA, 'joe@email.com', NA, NA, NA))
)
#> id email
#> 1 bob@email.com
#> 1
#> 2 joe@email.com
#> 2
#> 3
#> 3
(
foo <- bar[!duplicated(bar$id),]
)
#> id email
#> 1 bob@email.com
#> 2 joe@email.com
#> 3