trunc.POSIXt {Hmisc} | R Documentation |
return the floor, ceiling, or rounded value of date or time to specified unit.
Description
trunc.POSIXt
returns the date truncated to the specified unit.
ceiling.POSIXt
returns next ceiling of the date at the unit selected in
units
.
floor.POSIXt
trunk.POSIXt
by another name.
round.POSIXt
returns the date or time value rounded to nearest
specified unit selected in digits
.
trunc.POSIXt
and round.POSIXt
have been extended from
the base
package functions.
Usage
ceil(x, units,...)
## Default S3 method:
ceil(x, units, ...)
## S3 method for class 'POSIXt'
trunc(x, units = c("secs", "mins", "hours", "days",
"months", "years"), ...)
## S3 method for class 'POSIXt'
ceil(x, units = c("secs", "mins", "hours", "days",
"months", "years"), ...)
## S3 method for class 'POSIXt'
round(x, digits = c("secs", "mins", "hours", "days", "months", "years"))
Arguments
x |
date to be floored, ceilinged, truncated, or rounded |
units |
unit to that is is rounded up or down to. |
digits |
same as |
... |
further arguments to be passed to or from other methods. |
Value
An object of class POSIXlt
.
Author(s)
Charles Dupont
See Also
Date
POSIXt
POSIXlt
DateTimeClasses
Examples
date <- ISOdate(1832, 7, 12)
ceil(date, units='months') # '1832-8-1'
trunc(date, units='years') # '1832-1-1'
round.POSIXt(date, digits='months') # '1832-7-1'
[Package Hmisc version 3.14-6 Index]