I have a dataset of watertables and associated dates. I want to do something very simple: Mutate a column with seasons associated with the dates.
Example dataset:
Watertable date
2 2018-05-03
5 2018-08-01
12 2019-01-03
3 2019-07-29
4 2020-11-09
5 2021-08-22
Expected output:
Watertable date season
2 2018-05-03 Spring
5 2018-08-01 Summer
12 2019-01-03 Winter
3 2019-07-29 Summer
4 2020-10-09 Fall
5 2021-08-22 Summer
The dates are converted to 'date' using the lubridate package.
I can create the season column by mutating an extra column for only the month and days and using a case_when on that column, but this seems like an extra unnecessary step.
my question: how can i use mutate and case_when to create the new 'season' columnm, without having to create a new column with only the months and days. I.e. I want to use lubridate to select a period of dates omitting the year, because the new column is only depandant on the month and day value in the date.
I hope the question is clear. Happy to provide additional info when asked for.
starting dates seasons:
spring = 20 march
summer = 20 june
fall = 22 september
winter = 21 december