# coerce POSIXct/Dates to yearweek
x <- seq(as.Date("2016-01-01"), as.Date("2016-12-31"), by = "1 week")
yearweek(x)
yearweek(x, week_start = 7)
# parse characters
yearweek(c("2018 W01", "2018 Wk01", "2018 Week 1"))
# seq() and arithmetic
wk1 <- yearweek("2017 W50")
wk2 <- yearweek("2018 W12")
seq(from = wk1, to = wk2, by = 2)
wk1 + 0:9
# display formats
format(c(wk1, wk2), format = "%V/%Y")
make_yearweek(year = 2021, week = 10:11)
make_yearweek(year = 2020:2021, week = 10:11)
is_53weeks(2015:2016)
is_53weeks(1969)
is_53weeks(1969, week_start = 7)
Run the code above in your browser using DataLab