R-Help
Please disregard as I figure something out, unless there is a more elegant
way ...
myData.sum <- aggregate(x
myData[c("s72","s79","s82","s83","s116","s119")],
FUN = sum,
by = list(Group.date =
myData$shortdate))> head(myData.sum)
Group.date s72 s79 s82 s83 s116 s119
1 2016/10/03 75 74 36 33 96 10
2 2016/10/04 90 76 40 56 137 9
3 2016/10/05 106 83 38 51 90 10
4 2016/10/06 93 87 31 43 97 15
5 2016/10/07 88 96 33 48 125 12
6 2016/10/08 64 39 22 30 63 5
I created a "shortdate" for the purpose of aggregating each var (S72
.S119)
by daily sum , but not sure how to handle using a POSIXlt object.
> myData$shortdate <- strftime(myData$time, format="%Y/%m/%d")
> head(myData)
time s72 s79 s82 s83 s116 s119 shortdate
1 2016-10-03 00:00:00 0 0 1 0 0 0 2016/10/03
2 2016-10-03 01:00:00 0 0 0 0 0 0 2016/10/03
3 2016-10-03 02:00:00 0 0 0 0 24 0 2016/10/03
4 2016-10-03 03:00:00 1 0 0 0 0 0 2016/10/03
5 2016-10-03 04:00:00 0 0 0 0 1 0 2016/10/03
6 2016-10-03 05:00:00 1 0 1 0 0 1 2016/10/03
Jeff
[[alternative HTML version deleted]]