I need help classifying some date variables. I currently have a data set for that has an entry for every day for a twenty-year period, and I want to get averages for each month. For example, the data looks like this:
And I want to get the average ranger_peds value for each month, how would I go about coding for that? In the end I only want to have one entry for each month, so instead of having 2008-01-01, 2008-01-02, etc... it would look like 2008-01 and then another entry for 2008-02, etc...
I created a date called year_month which is based on the year and month, so all days in February 2014 will be 2014-02-01. Group by year_month and then calculate the mean for each group.