This help topic is for R version 1.5.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/cut.POSIXt.html
cut.POSIXt {base}R Documentation

Convert a Date-Time Object to a Factor

Description

Method for cut applied to date-time objects.

Usage

## S3 method for class 'POSIXt'
cut(x, breaks, labels=NULL, start.on.monday=TRUE, ...)

Arguments

x

an object inheriting from class "POSIXt".

breaks

a vector of cut points or number giving the number of intervals which x is to be cut into or an interval specification, one of "secs", "mins", "hours", "days", "weeks", "months" or "years".

labels

labels for the levels of the resulting category. By default, labels are constructed using "(a,b]" interval notation. If labels = FALSE, simple integer codes are returned instead of a factor.

start.on.monday

logical. If breaks = "weeks", should the week start on Mondays or Sundays?

...

arguments to be passed to or from other methods.

Value

A factor is returned, unless labels = FALSE which returns the integer level codes.

See Also

seq.POSIXt, cut

Examples

## random dates in a 10-week period
cut(ISOdate(2001, 1, 1) + 70*86400*runif(100), "weeks")

[Package base version 1.5.0 ]