I have a dataframe (or datatable, if that’s easier) with incomplete rows:
ID Var1 Var2 Var3
1 2 5 1
2 12 3
3 8
4 4
The empty cells are always at the end of a row.
I would like to fill the empty cells in each row with the value in the last non-empty cell in that row, e.g.:
ID Var1 Var2 Var3
1 2 5 1
2 12 3 -> 3
3 8 -> 8 -> 8
4 4 -> 4 -> 4
How do I do that?