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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ts_plot.R
\name{round_time}
\alias{round_time}
\title{A generic function for rounding date and time values}
\usage{
round_time(x, n, tz)
}
\arguments{
\item{x}{A vector of class POSIX or Date.}
\item{n}{Unit to round to. Defaults to mins. Numeric values treated
as seconds. Otherwise this should be one of "mins", "hours", "days",
"weeks", "months", "years" (plural optional).}
\item{tz}{Time zone to be used, defaults to "UTC" (Twitter default)}
}
\value{
If POSIXct then POSIX. If date then Date.
}
\description{
A generic function for rounding date and time values
}
\examples{
## class posixct
round_time(Sys.time(), "12 hours")
## class date
unique(round_time(seq(Sys.Date(), Sys.Date() + 100, "1 day"), "weeks"))
}
|