this_month: Start and end of month

View source: R/this_month.R

this_monthR Documentation

Start and end of month

Description

Defines first and last date in month

Usage

this_month(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_quarter(), this_year()

Examples

## To get start, end and sequence of this month
thismonth <- this_month()

## To get vector of date sequences 
this_month(part = "sequence")
this_month()$sequence
seq(thismonth)

## Get number of days of this months
day_nums <- this_month(part = "length")
this_month()$length
length(thismonth)

timeperiodsR documentation built on April 20, 2023, 5:13 p.m.