I have a file that looks like so:
date A B
2014-01-01 2 3
2014-01-02 5 NA
2014-01-03 NA NA
2014-01-04 7 11
If I use newdata <- na.omit(data)
where data
is the above table loaded via R, then I get only two data points. I get that since it will filter all instances of NA. What I want to do is to filter for each A
and B
so that I get three data points for A
and only two for B
. Clearly, my main data set is much larger than that and the numbers are different but neither should not matter.
How can I achieve that?
See Question&Answers more detail:os