Good day,
I have a dataset similar to that attached image and would like to mutate the People_ID to match the complete rows in R programming language.
CodePudding user response:
As mentioned before, tidyr::fill
should work fine if all of your results are in order; however, if you need to match based on ID, something like this should work (where df = your raw dataset):
lookup <- df[df$people_id != "",]
final <- merge(lookup, df, by="distinct_id", all = TRUE)