I would like to create a new column that displays the first year in V2 where the value of V3 appears. However, after null values I would like to put again the first year for the reappearance of V3.
That is, in possession of the following data:
I would like to get a new V4 column as follows:
I appreciate any help.
Below are the data:
structure(list(V1 = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3,
3, 3), V2 = c(2005, 2006, 2007, 2008, 2009, 2005, 2006, 2007,
2008, 2009, 2005, 2006, 2007, 2008, 2009), V3 = c(0, 0, 10, 25,
35, 12, 15, 0, 15, 17, 13, 0, 0, 15, 12)), row.names = c(NA,
15L), class = "data.frame")

