Learn R Programming

timeperiodsR (version 0.2.0)

custom_period: Custopm period

Description

Create tpr object between start and end dates

Usage

custom_period(start, 
              end,
              part = c("all", "start", "end", 
			           "sequence", "length"))

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". See details.

Value

Object of tpr class

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
# NOT RUN {
## 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