I have a dataframe like below:
SampleId Col1 Col2 Col3 Col4
1 st1 k p
2 st2 k
3 st3 k p g
4 st4 k p g s
I want the empty rows in the columns to be filled based on the available values from preceding columns, so something like below:
SampleId Col1 Col2 Col3 Col4
1 st1 k p p p
2 st2 k k k k
3 st3 k p g g
4 st4 k p g s
What would be a dplyr way to do this?