Re: [R] change frequency of wind data correctly

2020-12-07 Thread Bill Dunlap
Instead of using breaks="30 mins" construct the breaks explicitly with seq() so you can control the start point. E.g., > init_day <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M", tz="Etc/GMT-1") > fin_day <- as.POSIXct("2018-02-01-02-00", format="%Y-%m-%d-%H-%M", tz="Etc/GMT-1") > mydf

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Stefano Sofia
7 dicembre 2020 7.36 A: r-help@r-project.org; Richard O'Keefe; Stefano Sofia Cc: r-help mailing list Oggetto: Re: [R] change frequency of wind data correctly Beware of missing or extra records with these approaches. Also may be tricky to get the time aligned to the hour properly. On December 6,

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Jeff Newmiller
Beware of missing or extra records with these approaches. Also may be tricky to get the time aligned to the hour properly. On December 6, 2020 9:12:01 PM PST, Richard O'Keefe wrote: >To be honest, I would do this one of two ways. > >(1) Use ?decimate from library(signal), >decimating by a fa

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Richard O'Keefe
To be honest, I would do this one of two ways. (1) Use ?decimate from library(signal), decimating by a factor of three. (2) Convert the variable to an (n/3)*3 matrix using as.matrix then use rowMeans or apply. On Thu, 3 Dec 2020 at 06:55, Stefano Sofia wrote: > Dear list users, > I hav

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Ben Tupper
t > ---Oo-oO > > ____________ > Da: Jim Lemon [drjimle...@gmail.com] > Inviato: giovedì 3 dicembre 2020 4.41 > A: Stefano Sofia > Cc: r-help mailing list > Oggetto: Re: [R] change frequency of wind data correctly > > H

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Jeff Newmiller
06 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO Da: Jim Lemon [drjimle...@gmail.com] Inviato: gioved? 3 dicembre 2020 4.41 A: Stefano Sofia Cc: r-help mailing list Oggetto: Re: [R] change frequency of wind data correctly Hi

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Mathew Guilfoyle
Hi Stefano I think either of these does what you need... 1: This gets the interval column as you want it, but utilises the lubridate package: library(lubridate) mydf$interval = ceiling_date(mydf$data_POSIX, unit="30 minutes”) 2: Alternative in base R is a bit more long winded: convert the da

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Jeff Newmiller
- Da: Jim Lemon [drjimle...@gmail.com] Inviato: gioved? 3 dicembre 2020 4.41 A: Stefano Sofia Cc: r-help mailing list Oggetto: Re: [R] change frequency of wind data correctly Hi again, Didn't realize that the example didn't even span a full day.

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Stefano Sofia
arche.it ---Oo-oO Da: Jim Lemon [drjimle...@gmail.com] Inviato: giovedì 3 dicembre 2020 4.41 A: Stefano Sofia Cc: r-help mailing list Oggetto: Re: [R] change frequency of wind data correctly Hi again, Didn't realize that the example didn't even

Re: [R] change frequency of wind data correctly

2020-12-03 Thread Stefano Sofia
: giovedì 3 dicembre 2020 4.41 A: Stefano Sofia Cc: r-help mailing list Oggetto: Re: [R] change frequency of wind data correctly Hi again, Didn't realize that the example didn't even span a full day. ssdf<-read.table(text="date_POSIX time_POSIX vmax 2018-02-01 00:00:00 27 2018-02-01

Re: [R] change frequency of wind data correctly

2020-12-02 Thread Jim Lemon
Hi again, Didn't realize that the example didn't even span a full day. ssdf<-read.table(text="date_POSIX time_POSIX vmax 2018-02-01 00:00:00 27 2018-02-01 00:10:00 41 2018-02-01 00:20:00 46 2018-02-01 00:30:00 39 2018-02-01 00:40:00 34 2018-02-01 00:50:00 32 2018-02-01 01:00:00 37 2018-02-

Re: [R] change frequency of wind data correctly

2020-12-02 Thread Jim Lemon
Hi Stefano, I read in your date-time as two separate fields for convenience. You can split your single field at the space to get the same result. ssdf<-read.table(text="date_POSIX time_POSIX vmax 2018-02-01 00:00:00 27 2018-02-01 00:10:00 41 2018-02-01 00:20:00 46 2018-02-01 00:30:00 39 2018-

[R] change frequency of wind data correctly

2020-12-02 Thread Stefano Sofia
Dear list users, I have wind data with frequency of 10 minutes (three years data). For simplicity let me use only max wind speed. I need to reduce the frequency to 30 minutes, at 00 (taking the mean of data at 40, 50 and 00 minutes) and at 30 (taking the mean of data at 10, 20 and 30 minutes)