Last chance! 50% off unlimited learning
Sale ends in
Defines first and last date in week
this_week(x = Sys.Date(), part = c("all", "start", "end",
"sequence", "length"),
week_start = 1)
Date object
Part of period you need to receive, one of "all", "start", "end","sequence", "length". See details.
Start of week, default = 1 is Monday, 7 is Sunday
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 this_quarter()
, this_month()
, this_year()
# NOT RUN {
## To get start, end and sequence of this weeks
thisweek <- this_week()
## Get this week with start on Sunday
thisweeksun <- this_week(week_start = 7)
## To get vector of date sequences
this_week(part = "sequence")
this_week()$sequence
seq(thisweek)
## Get number of days of this 2 weeks
day_nums <- this_week(part = "length")
this_week()$length
length(thisweek)
# }
Run the code above in your browser using DataLab