Absolute newbie to R. I have a dataframe that has some common values in one column(C1), but only one of the corresponding column has a value(C2), so I want to paste that value to all of the empty/NA spaces in C2 based on same value in C1. This would make more sense:
df:
C1 C2
A NA
A val10
A NA
B val14
B NA
B NA
B NA
C NA
C val9
What I wanted it to look like is
C1 C2
A val10
A val10
A val10
B val14
B val14
B val14
B val14
C val9
C val9
(C2 and C1 don't have any particular pattern or sequence between each other)
I'm assuming I would do a Group_by for C1, but I'm bit confused how to copy the values. Using transmute/mutate or paste. I tried a few iterations but wasn't successful.