r - Remove 'Date' rows having any 'NA' in the 'Value' column -


i have data frame multiple time series . remove data in date have na values.

the data frame looks follows,

date    time    value 1/1/2014    0:00    30 1/1/2014    1:00    20 1/1/2014    2:00    12 1/1/2014    3:00    na     .        .        .    1/1/2014    23:00   23 2/1/2014    0:00    12 2/1/2014    1:00    23 2/1/2014    2:00    34 2/1/2014    3:00    43     .        .        .    2/1/2014    23:00   30 3/1/2014    0:00    34 3/1/2014    1:00    na 3/1/2014    2:00    na 3/1/2014    3:00    23     .        .        .    3/1/2014    23:00   45 

i remove data in date have na values data frame follows,

date    time    value 2/1/2014    0:00    12 2/1/2014    1:00    23 2/1/2014    2:00    34 2/1/2014    3:00    43     .        .        .    2/1/2014    23:00   30 

probably many ways this, here's one. find unique date values associated missing value, , remove rows final selection:

dat[!dat$date %in% unique(dat[is.na(dat$value),"date"]),]         date  time value 6  2/1/2014  0:00    12 7  2/1/2014  1:00    23 8  2/1/2014  2:00    34 9  2/1/2014  3:00    43 10 2/1/2014 23:00    30 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -