The following is an example of a data table in which I would like to delete rows where the value is NA, and none of the earlier rows have a value, that is, NA by group. Since not everyone has the same number of leading missing values, I'm stuck and not looking for luck.
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
Ready 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 attribute the missing values to those that come before and after.
EDIT: A previously asked question found here that is similar.
source
share