dtt_years {dttr2}R Documentation

Get and Set Year Values

Description

Gets and sets year values for date/time vectors.

Usage

dtt_years(x, ...)

dtt_years(x) <- value

dtt_set_year(x, value)

dtt_year(x, ...)

dtt_year(x) <- value

## S3 method for class 'Date'
dtt_year(x, ...)

## S3 method for class 'POSIXct'
dtt_year(x, ...)

## S3 replacement method for class 'Date'
dtt_year(x) <- value

## S3 replacement method for class 'POSIXct'
dtt_year(x) <- value

Arguments

x

A date/time vector.

...

Unused.

value

A integer vector of the year value(s).

Value

An integer vector (or the modified date/time vector).

Methods (by class)

Examples

x <- as.Date("1990-01-02")
dtt_year(x)
dtt_year(x) <- 11L
x

x <- as.POSIXct("1990-01-02 23:40:51")
dtt_year(x)
dtt_year(x) <- 2022L
x

[Package dttr2 version 0.3.0 Index]