## To get start, end and sequence of last 2 years,
## exclude current year
last2years <- last_n_years(n = 2)
## include current year
last2years_2 <- last_n_years(n = 2, include_current = TRUE)
## To get vector of date sequences
last_n_years(n = 2, part = "sequence")
last_n_years(n = 2)$sequence
seq(last2years)
## Get number of days of last 2 years
day_nums <- last_n_years(n = 2, part = "length")
last_n_years()$length
length(last2years)
Run the code above in your browser using DataLab