ref {bizdays}R Documentation

Creates date references to be used in getdate

Description

Date references are specifically months or years to be used in getdate. Months and years can be specified directly or can be base on a given date. getdate returns a date that is in the reference passed.

Usage

ref(x, ...)

## S3 method for class 'Date'
ref(x, ym = c("month", "year"), ...)

## S3 method for class 'character'
ref(x, ...)

## S3 method for class 'numeric'
ref(x, ...)

Arguments

x

a Date vector, a character vector (specifying dates, months or years) or a numeric vector (specifying years)

...

additional arguments

If a date (character or Date) is passed to ref it has to specified whether the reference is to the month or the year of the given date. This is set in the argument ym that accepts month (default) or year.

ym

a character string with the values month or year (see Details)

Examples

ref(as.Date("2018-01-01"), "month") # refers to 2018-01
ref("2018-01-01", "month")          # refers to 2018-01
ref("2018-01-01", "year")           # refers to 2018

ref(c("2018-01", "2018-02")) # refers to 2018-01 and 2018-02
ref("2018") # refers to 2018
ref(2010:2018) # refers to all years from 2010 to 2018


[Package bizdays version 1.0.6 Index]