wood is my dataframe
town date prec TP TC
TR 1/10/1983 NaN NaN 11.34
CR 2/12/1983 NaN NaN 4.3
TR 3/12/1983 11.22 11.36 NAN
SP 5/6/1985 NaN NaN 3.2
BM 6/7/1994 6.33 6.23 1.2
BM 5/6/1995 5.81 5.9 NAN
BM 1/11/2005 5.9 5.9 6.2
I want to get seasonal mean (average) of my data for each town separately. In the past I have used zoo function to find seasonal mean per year for prec. But Zoo has a hard time accepting another variable of town. Now I want to extend it to find seasonal average for “prec,TP, TC” by town per year So for Jan feb march average for 1983 and
May,jun,july average for 1985
Output should look like that. Also “R should not take NAN as zeros”. That is just missing data.
town date prec TP TC
TR 1983 11.22 11.36 7.82
SP 1985 6.07 6.07 2.2