Rev 28169 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{cut.POSIXt}\alias{cut.POSIXt}\alias{cut.Date}\title{Convert a Date or Date-Time Object to a Factor}\description{Method for \code{\link{cut}} applied to date-time objects.}\usage{\method{cut}{POSIXt}(x, breaks, labels = NULL, start.on.monday = TRUE,right = FALSE, \dots)\method{cut}{Date}(x, breaks, labels = NULL, start.on.monday = TRUE,right = FALSE, \dots)}\arguments{\item{x}{an object inheriting from class \code{"POSIXt"} or \code{"Date"}.}\item{breaks}{a vector of cut points \emph{or} number giving the number ofintervals which \code{x} is to be cut into \emph{or} aninterval specification, one of \code{"sec"}, \code{"min"},\code{"hour"}, \code{"day"}, \code{"DSTday"}, \code{"week"},\code{"month"} or \code{"year"}, optionally preceded by an integerand a space, or followed by \code{"s"}. For \code{"Date"} objectsonly \code{"day"}, \code{"week"}, \code{"month"} and \code{"year"}are allowed.}\item{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 \code{right}). If\code{labels = FALSE}, simple integer codes are returned insteadof a factor.}\item{start.on.monday}{logical. If \code{breaks = "weeks"}, should theweek start on Mondays or Sundays?}\item{right, \dots}{arguments to be passed to or from other methods.}}\value{A factor is returned, unless \code{labels = FALSE} which returnsthe integer level codes.}\seealso{\code{\link{seq.POSIXt}}, \code{\link{seq.Date}}, \code{\link{cut}}}\examples{## random dates in a 10-week periodcut(ISOdate(2001, 1, 1) + 70*86400*runif(100), "weeks")cut(as.Date("2001/1/1") + 70*runif(100), "weeks")}\keyword{manip}\keyword{chron}