File: round_time.Rd

package info (click to toggle)
r-cran-rtweet 2.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,068 kB
  • sloc: sh: 13; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (2)
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"))

}