[R] Count continuous dates

Tim Clark mudiver1200 at yahoo.com
Thu Nov 11 07:07:56 CET 2010


Dear List,

I have a series of dates and I am needing to know the greatest length of 
continuous dates - i.e. the number of dates before a break in the series.  For 
example, below there are three continuous series of dates with lengths 4, 6, and 
8.  How can I count the number of continuous dates?  rle() will do it for 
constant integers, but I can't figure a way to modify it for continuous dates.

x<-c("1/10/10","2/10/10","3/10/10","4/10/10",
     "6/10/10","7/10/10","8/10/10","9/10/10","10/10/10","11/10/10",
     
"13/10/10","14/10/10","15/10/10","16/10/10","17/10/10","18/10/10","19/10/10","20/10/10")

x<-strptime(x,"%d/%m/%y")



Thanks!

Tim
 Tim Clark
Marine Ecologist
National Park of American Samoa
Pago Pago, AS 96799 






More information about the R-help mailing list