[R] aggregate()

Petr Pikal petr.pikal at precheza.cz
Thu Jan 6 14:38:55 CET 2005



On 6 Jan 2005 at 16:55, Karla Meurk wrote:

> Hi, some time ago I asked R-help about aggregating data as a result I
> was able to put together some code which includes the line
> 
> rain.ag <- aggregate(newdata, list(hod6=cut(mindata,"6 hours")), mean,
> na.rm=T)
> 
> I also want to aggregate daily, and 30 minutely etc.
> 
> My question is why is it that I get answers with list(.. "hours") but
> R cannot cope with list(.."6 hours") or any other multiple.  I have
> tried overcoming this using nfrequency= but to no avail

Hi Karla

> aggregate(rnorm(100), list(weeks5 = cut(as.Date("2001/1/1") + 70*runif(100), "5 weeks")),mean)
      weeks5         x
1 2001-01-01 0.1272008
2 2001-02-05 0.1808671

This works as expected so you have some problems in your data 
and without giving more information what is mindata or what sort 
of answer you did get from above mentioned code nobody can 
help.

Cheers
Petr



> 
> can someone help?
> 
> Thanks
> 
> Carla
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list