Learn R Programming

dint (version 2.1.4)

get_year: Get Year, Quarter, Month or Isoweek

Description

Get Year, Quarter, Month or Isoweek

Usage

get_year(x)

get_quarter(x)

get_month(x)

get_isoweek(x)

get_isoyear(x)

Value

an integer vector.

Arguments

x

a date_xx or any R object that can be coerced to POSIXlt

Details

If you use lubridate in addition to dint, you can also use lubridate::year(), lubridate::month() and lubridate::quarter() with dint objects.

See Also

Examples

Run this code
x <- date_yq(2016, 2)
get_year(x)
if (FALSE) {
library(lubridate)
year(x)
}

x <- date_yq(2016, 2)
get_quarter(x)
if (FALSE) {
library(lubridate)
quarter(x)
}

x <- date_yq(2016, 2)
get_month(x)
if (FALSE) {
library(lubridate)
month(x)
}
x <- date_yw(2016, 2)
get_isoweek(x)

get_isoyear(as.Date("2018-01-01"))
get_isoyear(as.Date("2016-01-01"))

Run the code above in your browser using DataLab