\HeaderA{cut.POSIXt}{Convert a Date or Date-Time Object to a Factor}{cut.POSIXt}
\aliasA{cut.Date}{cut.POSIXt}{cut.Date}
\keyword{manip}{cut.POSIXt}
\keyword{chron}{cut.POSIXt}
\begin{Description}\relax
Method for \code{\LinkA{cut}{cut}} applied to date-time objects.
\end{Description}
\begin{Usage}
\begin{verbatim}
## 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, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object inheriting from class \code{"POSIXt"} or \code{"Date"}.
\item[\code{breaks}] a vector of cut points \emph{or} number giving the number of
intervals which \code{x} is to be cut into \emph{or} an
interval specification, one of \code{"sec"}, \code{"min"},
\code{"hour"}, \code{"day"}, \code{"DSTday"}, \code{"week"},
\code{"month"}, \code{"quarter"} or \code{"year"}, optionally
preceded by an integer and a space, or followed by \code{"s"}.
For \code{"Date"} objects only \code{"day"}, \code{"week"},
\code{"month"}, \code{"quarter"} and \code{"year"} are allowed.

\item[\code{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 instead
of a factor.

\item[\code{start.on.monday}] logical. If \code{breaks = "weeks"}, should the
week start on Mondays or Sundays?
\item[\code{right, ...}] arguments to be passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Using both \code{right = TRUE} and \code{include.lowest = TRUE}
will include both ends of the range of dates.

Using \code{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 \code{min(x)} as appropriate.
\end{Details}
\begin{Value}
A factor is returned, unless \code{labels = FALSE} which returns
the integer level codes.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{seq.POSIXt}{seq.POSIXt}}, \code{\LinkA{seq.Date}{seq.Date}}, \code{\LinkA{cut}{cut}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## 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")
\end{ExampleCode}
\end{Examples}

