I have a variable that represents the week of the year (1-53) and I'd like to create new week variables by both adding to and subtracting weeks from it in a way that makes sense given a calendar year.
If I use week + 4
, and week = 52
, I get week_plus_four = 56;
similarly, if I use week - 4
, and week = 2
, I'd get week_minus_four = - 2
. This makes sense, but I'm wondering if there is a function in lubridate or another package that allows you to add and subtract weeks more intuitively.
I know that I could create a function that "wraps around" Dec-Jan, but I wanted to see if there's an existing function that I might have missed in reading through the package notes.