Try this:

aggregate(DF[c('data1','data2')], list(gsub('\\..*', '', DF$time)), FUN =
sum)

On Mon, Apr 19, 2010 at 12:00 PM, jennyed <jen.wri...@ed.ac.uk> wrote:

>
> Hi all,
>
> I have a set of data in hourly time steps with each row identified as
> time          data column1             data column2
> 1                  9999                            9999
> 1.042            9999                            9999
> 1.083            9999                            9999
> 1.125            9999                            9999
> 1.167            9999                            9999
> 1.208            9999                            9999
> 1.25             9999                            9999.....and so on (the
> time column is in fractions of a day)
>
> I want to be able to group the data by day. I managed to do this using:
>
> Day1H = hourlydata[c(1:24),]
>
> but I'd like to be able to create groups for each day without doing this
> manually for each set of 24 rows.
>
> Any suggestions greatly appreciated
>
> Thanks
>
>
> --
> View this message in context:
> http://n4.nabble.com/Grouping-rows-of-data-by-day-tp2016063p2016063.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to