Creating dummy variables for an R dataframe based on various groupings of months Assume I have a dataframe with one column of class “Date” in R: