On Nov 20, 2009, at 6:26 AM, Stefan Strohmeier wrote:

Dear R users,

I have a time series of precipitation data. The time series comprises ~ 20 years and it is supposed to be constant (one value per day), but due to some failure of the measuring device some days or periods are missing. I would like to find these missing days or periods just to get a first idea about the reliability of the measurements. The only function I could find was is.constant(), but of course I only get a true or false statement instead of the dates missing. Google searches and a look at the R help mailing did not reveal an answer.

Please find attached a few dates of the time series with missing values from February to April. I would like R to detect those missing dates.

> dtdta <- read.table(textConnection("2916 2002-02-17  0.0
+ 2917 2002-02-18  0.3
+ 2918 2002-02-19  3.8
+ 2919 2002-02-20 43.6
+ 2920 2002-02-21  1.0
+ 2921 2002-02-22  5.6
+ 2922 2002-02-23 10.6
+ 2923 2002-02-24  2.8
+ 2924 2002-02-25 19.1
+ 2925 2002-02-26 20.5
+ 2926 2002-03-06  0.0
+ 2927 2002-05-06  0.0
+ 2928 2002-05-07  0.0
+ 2929 2002-05-08  0.0
+ 2930 2002-05-09  0.0") )

> dtdta[dtdta$V3 == 0, ]

     V1         V2 V3
1  2916 2002-02-17  0
11 2926 2002-03-06  0
12 2927 2002-05-06  0
13 2928 2002-05-07  0
14 2929 2002-05-08  0
15 2930 2002-05-09  0

You seem to be using "0" as a missing marker. That's bad practice, but I suppose it's possble you cannot change how your instruments report. You should be using NA and the functions that support proper treatment of "missingness".

--
David
Any hints or solutions are highly appreciated.

Regards,
Stefan Strohmeier

2916 2002-02-17  0.0
2917 2002-02-18  0.3
2918 2002-02-19  3.8
2919 2002-02-20 43.6
2920 2002-02-21  1.0
2921 2002-02-22  5.6
2922 2002-02-23 10.6
2923 2002-02-24  2.8
2924 2002-02-25 19.1
2925 2002-02-26 20.5
2926 2002-03-06  0.0
2927 2002-05-06  0.0
2928 2002-05-07  0.0
2929 2002-05-08  0.0
2930 2002-05-09  0.0

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to