this_year {timeperiodsR}R Documentation

Start and end of year

Description

Defines first and last date in year

Usage

this_year(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:

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 year
thisyear <- this_year()

## To get vector of date sequences 
this_year(part = "sequence")
this_year()$sequence
seq(thisyear)

## Get number of days of this year
day_nums <- this_year(part = "length")
this_year()$length
length(thisyear)

[Package timeperiodsR version 0.7.3 Index]