Learn R Programming

timeperiodsR (version 0.7.3)

custom_period: Custopm period

Description

Create tpr object between start and end dates

Usage

custom_period( start, 
               end,
               part = getOption("timeperiodsR.parts"))

Value

Object of tpr class

Arguments

start

Start date in YYYY-MM-DD format

end

End date in YYYY-MM-DD format

part

Part of period you need to receive, one of "all", "start", "end","sequence", "length", "workdays", "weekends", "first_workday", "last_workday", "first_weekend", "last_weekend", "length". See details.

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

Examples

Run this code
## To create tpr object between two dates
customper <- custom_period(start = "2019-09-01",
                           end   = "2019-09-05")

## To get vector of date sequences 
seq(customper)

## Get number of days of previous months
length(customper)

## To get start of end dates
start(customper)
end(customper)

Run the code above in your browser using DataLab