this_quarter: Start and end of quarter

View source: R/this_quarter.R

this_quarterR Documentation

Start and end of quarter

Description

Defines first and last date in quarter

Usage

this_quarter(x = Sys.Date(),
             part = getOption("timeperiodsR.parts"))

Arguments

x

Date object

part

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

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

Value

Object of tpr class

Author(s)

Alexey Seleznev

See Also

For get next other periods see this_week(), this_month(), this_year()

Examples

## To get start, end and sequence of this quarter
thisquarter <- this_quarter()

## To get vector of date sequences 
this_quarter(part = "sequence")
this_quarter()$sequence
seq(thisquarter)

## Get number of days of this quarter
day_nums <- this_quarter(part = "length")
this_quarter()$length
length(thisquarter)

selesnow/timeperiodsR documentation built on Jan. 27, 2024, 7:32 a.m.