[R] Changing time intervals in data set

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Wed Dec 15 22:12:39 CET 2021


On Wed, 15 Dec 2021, jim holtman wrote:

> At least show a sample of the data and then what you would like as output.

Jim,

There are 813,694 rows of data. As I wrote,
>> A 33-year set of river discharge data at one gauge location has recording
>> intervals of 5, 10, and 30 minutes over the period of record.

Also, 15 minute intervals

>> The data.frame/tibble has columns for year, month, day, hour, minute, and
>> datetime.

As well as a site_nbr.

What I asked is,

>> Would difftime() allow me to find the dates when the changes occurred?

I'm scrolling through the data file (not the R dataframe). The output I've
so far generated manually:

1988-10-01 00:10 - 1991-03-12 23:50  10 min
1991-03-19 00:00 - 1994-07-05 23:45  15 min
2003-04-03 00:00 - 2004-01-31 10:30  30 min
2004-01-31 10:40 - 2004-01-31 15:30   5 min
2004-01-31 16:00 - 2008-06-27 11:00  30 min
2008-06-27 11:10 - 2008-07-07 15:30   5 min
2008-07-07 16:00 - 2009-05-26 13:00  30 min
2009-05-26 13:15 - 2009-05-27 06:30   5 min
2009-05-27 07:00 - 2009-06-11 08:00  30 min
2009-06-11 08:15 - 2009-06-12 08:50   5 min
2009-06-12 09:00 - 2010-09-07 08:00  30 min
2010-09-07 08:20 - 2010-09-07 18:00   5 min
2010-09-07 18:30 - 2010-09-09 07:30  30 min
2010-09-09 07:45 - 2010-09-13 11:15   5 min
2010-09-13 11:30 - 2010-12-01 07:30  30 min
2010-12-01 07:50 - 2010-12-02 15:50   5 min
2010-12-02 16:00 - 2010-12-17 10:00  30 min
2010-12-17 10:05 - 2010-12-20 08:35   5 min
2010-12-20 09:00 - 2011-05-20 09:00  30 min
2011-05-20 09:05 - 2011-05-23 06:40   5 min
2011-05-23 07:00 - 2011-08-18 17:30  30 min
2011-08-18 17:45 - 2011-12-14 06:15  15 min
2011-12-14 06:20 - 2011-12-14 17:35   5 min
2011-12-14 17:45 - 2012-06-28 06:15  15 min
2012-06-28 06:25 - 2012-06-28 14:30   5 min
2012-06-28 14:45 - 2012-10-12 06:15  15 min
2012-10-12 06:25 - 2012-10-12 15:45   5 min
2012-10-12 16:00 - 2014-01-17 07:00  15 min
2014-01-17 07:05 - 2014-01-21 07:05   5 min
2014-01-21 07:15 - 2015-04-03 07:30  15 min

Rich



More information about the R-help mailing list