dtt_years | R Documentation |
Gets and sets year values for date/time vectors.
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
x |
A date/time vector. |
... |
Unused. |
value |
A integer vector of the year value(s). |
An integer vector (or the modified date/time vector).
dtt_year(Date)
: Get integer vector of year values for a Date vector
dtt_year(POSIXct)
: Get integer vector of year values for a POSIXct vector
dtt_year(Date) <- value
: Set year values for a Date vector
dtt_year(POSIXct) <- value
: Set year values for a POSIXct vector
dtt_year_decimal()
Other set date:
dtt_day()
,
dtt_months()
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.