Why is there no apply.hourly in R with xts/zoo?

后端 未结 3 1155
孤城傲影
孤城傲影 2020-12-29 14:37

I want to aggregate data by hourly mean. Daily is very easy:

apply.daily(X2,mean)

Why is there no function for hourly? I tried

         


        
3条回答
  •  渐次进展
    2020-12-29 15:07

    hr.means <- aggregate(X2, format(time(X2),"%y-%m-%d %H"), mean) 
    

    This should work fine.

提交回复
热议问题