previous_month {timeperiodsR}R Documentation

Start and end of previous month

Description

Defines first and last date in n previous month

Usage

previous_month(x = Sys.Date(),
               n = 1, 
               part = getOption("timeperiodsR.parts"))

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.

Details

You can get object of tpr class with all components or specify which component you need, use part for manage this option:

Value

Object of tpr class

Author(s)

Alexey Seleznev

See Also

For get next other periods see previous_week(), previous_quarter(), previous_year()

Examples

## To get start, end and sequence of previous month
previousmonth <- previous_month()

## To get vector of date sequences 
previous_month(part = "sequence")
previous_month()$sequence
seq(previousmonth)

## Get number of days of previous months
day_nums <- previous_month(part = "length")
previous_month()$length
length(previousmonth)

[Package timeperiodsR version 0.7.3 Index]