根据多年的每日天气数据进行每日平均计算? [英] Daily average calculation from multiple year daily weather data?

查看:62
本文介绍了根据多年的每日天气数据进行每日平均计算?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有从1984年到2014年的31年的每日数据.我想计算变量的31年的每日平均值

I have a daily data for 31 years from 1984 to 2014. I would like to compute the daily average for 31 years for the variables

date    Min_daily   Max_daily   Rain_daily 
01-01-1984  18.8    3.6          0  
02-01-1984  20.2    3.8          0  
03-01-1984  19      4.2          0
.
.
.
30-12-2014  19.4    2.2          0
31-12-2014  18.5    7            0
01-01-2015  17.2    7.2          0

如何在R软件中执行该操作?

How to do it in R software?

推荐答案

创建新变量

yourData$day <- format(yourData$date, format='%m-%d')

并使用您最喜欢的均值聚合器,在基数R tapplyaggregate中使用零食.

And use your favorite mean aggregator, in base R tapply or aggregate work a treat.

示例:aggregate(cbind(Min_daily, Max_daily, Rain_daily) ~ day, data=yourData)

这篇关于根据多年的每日天气数据进行每日平均计算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆