Last chance! 50% off unlimited learning
Sale ends in
Defines first and last date in previous period
last_n_days(x = Sys.Date(),
n = 1,
part = c("all", "start", "end",
"sequence", "length"),
include_current = F)
Date object
Number of periods for offset
Part of period you need to receive, one of "all", "start", "end","sequence", "length". See details.
If TRUE incliding current period in sequence
Object of tpr class
You can get object of tpr class with all components or specify which component you need, use part
for manage this option:
all - get all components
start - get only first date of period
end - get only last date of period
start - get vector of all dates in period
length - get number of dates in period
For get next other periods see last_n_quarters()
, last_n_months()
, last_n_years()
, last_n_weeks()
# NOT RUN {
## To get start, end and sequence of last 10 days,
## exclude today
last10days <- last_n_days(n = 10)
## include today
last10days_2 <- last_n_days(n = 10, include_current = TRUE)
## To get vector of date sequences
last_n_days(n = 10, part = "sequence")
last_n_days(n = 10)$sequence
seq(last10days)
# }
Run the code above in your browser using DataLab