trunc.POSIXt {Hmisc} | R Documentation |
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
.
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"))
x |
date to be floored or ceilinged |
units |
unit to that is is rounded up or down to. |
digits |
same as units but different name to be compatible
with round generic.
|
An object of class POSIXlt
.
Charles Dupont
date <- ISOdate(1832, 7, 12) ceil(date, units='months') # '1-8-1832' trunc(date, units='years') # '1-1-1832' round.POSIXt(date, digits='months') # '1-7-1832'