Below is an example data table, which I would like to remove the rows where value is NA and no earlier row has a value, i.e. also NA, and by group. As not all have the same number leading missing values I'm getting stuck and not having any luck searching.
Example data table
group date value
a 2015-01-01 NA
a 2015-01-02 2
a 2015-01-03 3
a 2015-01-04 NA
a 2015-01-05 2
b 2015-01-01 NA
b 2015-01-02 NA
b 2015-01-03 2
b 2015-01-04 NA
b 2015-01-05 2
Finished data table
group date value
a 2015-01-02 2
a 2015-01-03 3
a 2015-01-04 NA
a 2015-01-05 2
b 2015-01-03 2
b 2015-01-04 NA
b 2015-01-05 2
Later I plan to impute the missing values by those that come before and after.
EDIT: Found previously asked question here, which is similar.