cut.POSIXt {base} | R Documentation |
Method for cut
applied to date-time objects.
## S3 method for class 'POSIXt' cut(x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ...) ## S3 method for class 'Date' cut(x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ...)
x |
an object inheriting from class |
breaks |
a vector of cut points or number giving the number of
intervals which |
labels |
labels for the levels of the resulting category. By default,
labels are constructed from the left-hand end of the intervals
(which are include for the default value of |
start.on.monday |
logical. If |
right, ... |
arguments to be passed to or from other methods. |
Using both right = TRUE
and include.lowest = TRUE
will include both ends of the range of dates.
Using breaks = "quarter"
will create intervals of 3 calendar
months, with the intervals beginning on January 1, April 1,
July 1 or October 1, based upon min(x)
as appropriate.
A factor is returned, unless labels = FALSE
which returns
the integer level codes.
## random dates in a 10-week period cut(ISOdate(2001, 1, 1) + 70*86400*stats::runif(100), "weeks") cut(as.Date("2001/1/1") + 70*stats::runif(100), "weeks")