Learn R Programming

timeperiodsR (version 0.7.3)

next_n_days: Start and end of next n days

Description

Defines first and last date in next period

Usage

next_n_days(x = Sys.Date(), 
            n = 1, 
			      part = getOption("timeperiodsR.parts"), 
			      include_current = F)

Value

Object of tpr class

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.

include_current

If TRUE incliding current period in sequence

Author

Alexey Seleznev

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

  • start - get vector of all dates in period

  • length - get number of dates in period

See Also

For get next other periods see next_n_quarters(), next_n_months(), next_n_years(), next_n_weeks()

Examples

Run this code
## To get start, end and sequence of next 10 days, 
## exclude today
next10days <- next_n_days(n = 10)

## include today
next10days_2 <- next_n_days(n = 10, include_current = TRUE)

## To get vector of date sequences 
next_n_days(n = 10, part = "sequence")
next_n_days(n = 10)$sequence
seq(next10days)

Run the code above in your browser using DataLab