I am looking for an efficient way to manipulate a lot of data in order to repeat the value of the last row of a group (given by the value in V1) in all the rows in the same column from the same group.
Input:
id V1 V2 V3
1  A  10 0
2  A  13 0
3  A  20 0
4  A  0  10
5  B  25 0
6  B  14 0
7  B  1  0
8  B  0  6
Output:
id V1 V2 V3
1  A  10 10
2  A  13 10
3  A  20 10
4  A  0  10
5  B  25 6
6  B  14 6
7  B  1  6
8  B  0  6
 
     
    