[R] avarage my data each hour

R. Michael Weylandt michael.weylandt at gmail.com
Wed Nov 7 00:02:22 CET 2012


library(xts)
period.apply()

might also be helpful.

Michael

On Tue, Nov 6, 2012 at 7:32 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> You should provide us with a data example. Since you haven't, look at the
> following code and see if you understand it.
>
> # Make up some data
> x <- Sys.time() + (1:1000)*15
> y <- rnorm(1000)
>
> brks <- cut(x, breaks = "hour")  # hour breaks
> tapply(y, brks, mean)   # hourly means of 'y'
>
>
> Hope this helps,
>
> Rui Barradas
> Em 06-11-2012 18:57, B. Bahar escreveu:
>
>> Hello,
>>
>> I have much more than one milion tempreture is gained each 15 seconds. So
>> each 15 seconds, I have one data.
>> How could I calculate avarage datas in each hour in R?
>>
>> If you could help me.
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list