Learn R Programming

dttr2 (version 0.4.0)

dtt_date: Floor Date

Description

Coerces vectors to floored Date vectors.

Usage

dtt_date(x, ...)

dtt_date(x) <- value

# S3 method for integer dtt_date(x, ...)

# S3 method for double dtt_date(x, ...)

# S3 method for character dtt_date(x, ...)

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

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

# S3 method for hms dtt_date(x, ...)

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

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

dtt_set_date(x, value)

Value

A floored Date vector.

Arguments

x

A vector.

...

Unused.

value

A date vector.

Methods (by class)

  • integer: Coerce integer vector to a floored Date vector

  • double: Coerce double vector to a floored Date vector

  • character: Coerce character vector to a floored Date vector

  • Date: Coerce Date vector to a floored Date vector

  • POSIXct: Coerce POSIXct vector to a floored Date vector

  • hms: Coerce hms vector to a floored Date vector

  • Date: Set date values for a Date vector

  • POSIXct: Set date values for a POSIXct vector

See Also

Other floor: dtt_date_time(), dtt_floored(), dtt_floor(), dtt_set_time()

Examples

Run this code
dtt_date(1L)
dtt_date(-1)
dtt_date("2000-01-01")
as.Date(as.POSIXct("2019-05-01", tz = "Etc/GMT-8"))
dtt_date(as.POSIXct("2019-05-01", tz = "Etc/GMT-8"))
dtt_date(hms::as_hms("23:59:59"))
dtt_date(hms::as_hms("24:00:00"))

Run the code above in your browser using DataLab