next_week: Start and end of next week

View source: R/next_week.R

next_weekR Documentation

Start and end of next week

Description

Defines first and next date in n next week

Usage

next_week(x = Sys.Date(),
          n = 1, 
          part = getOption("timeperiodsR.parts"),
          week_start = 1)

Arguments

x

Date object

n

Number of periods for offset

part

Part of period you need to receive, one of "all", "start", "end","sequence", "length". See details.

week_start

Start of week, default = 1 is Monday, 7 is Sunday

Details

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 next date of period

  • start - get vector of all dates in period

  • length - get number of dates in period

Value

Object of tpr class

Author(s)

Alexey Seleznev

See Also

For get next other periods see next_month(), next_quarter(), next_year()

Examples

## To get start, end and sequence of next weeks
nextweek <- next_week()

## Get next week with start on Sunday
nextweeksun <- next_week(week_start = 7)

## To get vector of date sequences 
next_week(part = "sequence")
next_week()$sequence
seq(nextweek)

## Get number of days of next 2 weeks
day_nums <- next_week(part = "length")
next_week()$length
length(nextweek)

timeperiodsR documentation built on June 22, 2024, 12:23 p.m.