我有这样的每日天气预报。我想要的是计算最高、最低和观测温度的月平均值,然后绘制这三条线。我已经像这样转换日期格式:
Date = as.POSIXlt(Weather2011$Date, format = "%m/%d/%Y")
Year = as.numeric(format(Date, format = "%Y"))
Month = as.numeric(format(Date, format = "%m"))
Week = as.numeric(format(Date, format = "%U"))
Weekday = as.numeric(format(Date, format = "%w"))
Weather2011
看起来像这样:
Date Max.Temp Min.Temp Temp Date Year Month Week Weekday
6/3/2010 87 63 63 2010-06-03 2010 6 22 4
6/4/2010 83 63 73 2010-06-04 2010 6 22 5