我有這樣按月獲得平均值爲某些月份中的R
logMosqm2 Date
[1,] -4.0000000 10296
[2,] -4.0000000 10313
[3,] -4.0000000 10342
[4,] -4.0000000 10388
[5,] -0.9592633 10526
[6,] -4.0000000 10572
只有四個列(類似於第一)和多行的數據。
我想獲得的平均每月爲logMosm2(和其它類似的變量),但只有幾個月來都在歲月2004年,2005年和2006年
關於日期:這些來自
yearfish <- cbind(logMosqm2, Date)
只是使用日期給
"1998-03-11" "1998-03-28" "1998-04-26" "1998-06-11" "1998-10-27"
中表日以來1月1日的日期是1970年
編輯:我發現功能在ZOO
包。所以我現在有一個變量yearmon:
[1] "Mar 1998" "Mar 1998" "Apr 1998" "Jun 1998"
[5] "Oct 1998" "Dec 1998" "Apr 1999" "Nov 1999"
[9] "Feb 2000" "Feb 2000" "Mar 2000" "Apr 2000"
[13] "May 2000" "Jun 2000" "Oct 2000" "Dec 2000"
[17] "Mar 2001" "Jun 2001" "Sep 2001" "Jan 2002"
[21] "Jun 2002" "Dec 2002" "Apr 2003" "Jun 2003"
[25] "Jan 2004" "Mar 2004" "Apr 2004" "May 2004"
[29] "Jun 2004" "Jun 2004" "Jul 2004" "Jul 2004"
[33] "Jul 2004" "Aug 2004" "Aug 2004" "Aug 2004"
[37] "Aug 2004" "Aug 2004" "Aug 2004" "Sep 2004"
[41] "Sep 2004" "Sep 2004" "Sep 2004" "Sep 2004"
[45] "Sep 2004" "Sep 2004" "Sep 2004" "May 2005"
[49] "May 2005" "May 2005" "May 2005" "May 2005"
[53] "May 2005" "Jun 2005" "Jun 2005" "Jun 2005"
[57] "Jul 2005" "Jul 2005" "Jul 2005" "Aug 2005"
[61] "Aug 2005" "Aug 2005" "Sep 2005" "Sep 2005"
[65] "Sep 2005" "May 2006" "May 2006" "May 2006"
[69] "Jun 2006" "Jun 2006" "Jun 2006" "Jul 2006"
[73] "Jul 2006" "Sep 2006" "Sep 2006" "Apr 2007"
[77] "May 2007" "Jul 2007" "Sep 2007" "Jan 2008"
[81] "Mar 2008" "May 2008"
那是什麼日期格式? –
數據最初來自格式爲10/14/1993的日期.csv文件。我用read.csv將它們讀入'R'。這些(我認爲)沒有格式化的日期。 –
我還是很困惑。所以上面的'10296'是'10/2/96'? –