### Subversion checkout URL

You can clone with HTTPS or Subversion.

Fetching contributors…

Cannot retrieve contributors at this time

file 48 lines (45 sloc) 1.139 kb
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 \name{round_date}\alias{round_date}\title{Rounding for date-times.}\usage{  round_date(x,    unit = c("second", "minute", "hour", "day", "week", "month", "year"))}\arguments{  \item{x}{a vector of date-time objects}  \item{unit}{a character string specifying the time unit  to be rounded to. Should be one of  "second","minute","hour","day", "week", "month", or  "year."}}\value{  x with the appropriate units rounded}\description{  round_date takes a date-time object and rounds it to the  nearest integer value of the specified time unit. Users  can specify whether to round to the nearest second,  minute, hour, day, week, month, or year.}\examples{x <- as.POSIXct("2009-08-03 12:01:59.23")round_date(x, "second")# "2009-08-03 12:01:59 CDT"round_date(x, "minute")# "2009-08-03 12:02:00 CDT"round_date(x, "hour")# "2009-08-03 12:00:00 CDT"round_date(x, "day")# "2009-08-04 CDT"round_date(x, "week")# "2009-08-02 CDT"round_date(x, "month")# "2009-08-01 CDT"round_date(x, "year")# "2010-01-01 CST"}\seealso{  \code{\link{floor_date}}, \code{\link{ceiling_date}}}\keyword{chron}\keyword{manip}
Something went wrong with that request. Please try again.