[R] Calculate daily means from 5-minute interval data
r@hep@rd @end|ng |rom @pp|-eco@y@@com
Sun Aug 29 18:52:45 CEST 2021
On Sun, 29 Aug 2021, Jeff Newmiller wrote:
> The general idea is to create a "grouping" column with repeated values for
> each day, and then to use aggregate to compute your combined results. The
> dplyr package's group_by/summarise functions can also do this, and there
> are also proponents of the data.table package which is high performance
> but tends to depend on altering data in-place unlike most other R data
> handling functions.
> Also pay attention to missing data... if you have any then you will need
> to consider whether you want the strictness of na.rm=FALSE or
> permissiveness of na.rm=TRUE for your aggregation functions.
Thank you. Yes, there are missing data as sometimes the equipment fails, or
there's some other reason why some samples are missing.
Grouping on each day is just what I need. I'll re-learn dplyr and take a
look at data.table.
More information about the R-help