[R] how to divide a data frame of half-hourly wind observations into subset of three hours

2015-09-11 Thread Stefano Sofia
Dear R-users, from a data frame of half-hourly wind observations (direction and speed, three years data), I need to evaluate the first main direction for each period of three hours (h03, h06, h09, h12, h15, h18, h21, h24 of each day). The command "windRose" of the package "openair" crates a

Re: [R] how to divide a data frame of half-hourly wind observations into subset of three hours

2015-09-11 Thread PIKAL Petr
Hi if you have full set of data, so no observation is missing, you can split your data frame values e.g. by split(yourdata, trunc(0:nrow(yourdata))/6) and use lapply or for cycle. If you need to cut according to dates you can use ?cut POSIX date. Cheers Petr > -Original Message-