Re: [R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-22 Thread Stefano Sofia
Da: Eric Berger [ericjber...@gmail.com] Inviato: martedì 22 settembre 2020 11.00 A: Jeff Newmiller Cc: Stefano Sofia; r-help mailing list Oggetto: Re: [R] aggregate semi-hourly data not 00-24 but 9-9 Thanks Jeff. Stefano, per Jeff's comment, yo

Re: [R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-22 Thread Eric Berger
Thanks Jeff. Stefano, per Jeff's comment, you can replace the line df1$data_POSIXminus9 <- df1$data_POSIX - lubridate::hours(9) by df1$data_POSIXminus9 <- df1$data_POSIX - as.difftime(9,units="hours") On Mon, Sep 21, 2020 at 8:06 PM Jeff Newmiller wrote: > > The base R as.difftime function is

Re: [R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-21 Thread Jeff Newmiller
The base R as.difftime function is perfectly usable to create this offset without pulling in lubridate. On September 21, 2020 8:06:51 AM PDT, Eric Berger wrote: >Hi Stefano, >If you mean from 9am on one day to 9am on the following day, you can >do a trick. Simply subtract 9hrs from each timestam

Re: [R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-21 Thread Eric Berger
Hi Stefano, If you mean from 9am on one day to 9am on the following day, you can do a trick. Simply subtract 9hrs from each timestamp and then you want midnight to midnight for these adjusted times, which you can get using the method you followed. I googled and found that lubridate::hours() can be

[R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-21 Thread Stefano Sofia
Dear R-list members, I have semi-hourly snowfall data. I should sum the semi-hourly increments (only the positive ones, but this is not described in my example) day by day, not from 00 to 24 but from 9 to 9. I am able to use the diff function, create a list of days and use the function aggregate