Learn R Programming

dttr2 (version 0.5.2)

dtt_months: Get and Set Month Values

Description

Gets and sets month values for date/time vectors.

Usage

dtt_months(x, ...)

dtt_months(x) <- value

dtt_month(x, ...)

dtt_month(x) <- value

# S3 method for Date dtt_month(x, ...)

# S3 method for POSIXct dtt_month(x, ...)

# S3 method for Date dtt_month(x) <- value

# S3 method for POSIXct dtt_month(x) <- value

dtt_set_month(x, value)

Value

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

Arguments

x

A date/time vector.

...

Unused.

value

A integer vector of the month value(s).

Methods (by class)

  • dtt_month(Date): Get integer vector of month values for a Date vector

  • dtt_month(POSIXct): Get integer vector of month values for a POSIXct vector

Functions

  • dtt_month(Date) <- value: Set month values for a Date vector

  • dtt_month(POSIXct) <- value: Set month values for a POSIXct vector

See Also

dtt_month_decimal()

Other set date: dtt_day(), dtt_years()

Examples

Run this code
x <- as.Date("1990-01-02")
dtt_month(x)
dtt_month(x) <- 11L
x

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

Run the code above in your browser using DataLab