How would flash filling based on observation data that is tied to another column look for R? Example
df <- data.frame(A = c(1,1,1,1,2,2,2,2),
B = c('my initials1', NA, NA, NA,NA,'my initials2',NA,NA))
Is there a way to have my initials (which are tied to 1) fill down? I've tried
df |> fill(B)
But what happens is it fills down to the next observation in B. Where I'd like the fill to stop at the end of 1 based on column A instead. I was just thinking of copying the data to a separate data frame and joining it on A to achieve that.