I have a data frame,
data.frame(Primary_key = c(100,100,100,100,200,200,200) ,
values= c("buyer",NA,NA,NA,"seller",NA,NA))
I'm trying to get a desired output of,
data.frame(Primary_key = c(100,100,100,100,200,200,200) ,
values= c("buyer","buyer","buyer","buyer","seller","seller","seller"))
This is a simplified version the original has 3 possible values and over 10,000 different primary keys.
Thinking of a dplyr
way to do this but kind of stumped.
I'm trying to group_by
the primary key and then use a replace
function.