## S3 method for class 'Date': cut(x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ...) ## S3 method for class 'POSIXt': cut(x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ...)
| x | a Date or POSIXt object. | 
| breaks | 
 | 
| labels | a character vector specifying the labels for the intervals. The default is to encode the breakpoints to make up interval names. | 
| start.on.monday | a logical value. Specifies if week should start on Monday or Sunday when breaks = "weeks". | 
| right | a logical value. Passed to cut.default. See Details in cut. | 
| ... | additional arguments. | 
| labels != FALSE | a factor or ordered factor as long as x indicating in which group each point in x belongs, along with the attribute levels, which is a vector of character names for each group. | 
| labels == FALSE | an integer vector (instead of a factor) as long as x indicating in which group each point in x belongs. | 
## cut.Date
dt <- seq(as.Date("2008-01-01"), as.Date("2010-12-31"), 
   length.out = 10)
cut(dt, breaks = "months")
cut(dt, breaks = "months", right = TRUE)
cut(dt, breaks = 5)
cut(dt, breaks = as.Date(c("2008-8-8", "2009-8-8", "2010-8-8")))
cut(dt, breaks = "years", labels = c("Y2008", "Y2009", "Y2010", 
   "Y2011"))
cut(dt, breaks = "years", labels = FALSE)
## cut.POSIXt
plt <- seq(as.POSIXlt("2010-01-01"), as.POSIXlt("2010-12-31"), 
   length.out = 10)
cut(plt, breaks = "weeks")
cut(plt, breaks = "weeks", start.on.monday = FALSE, right = TRUE)
cut(plt, breaks = 5)
cut(plt, breaks = as.POSIXlt(c("2010-3-1", "2010-7-8", "2010-10-30")))
cut(plt, breaks = "quarters", labels = c("Q1", "Q2", "Q3", "Q4"))
cut(plt, breaks = "quarters", labels = FALSE)
## days v.s. DSTdays
## The start date-time of DST in USA 2011 is: 2011-03-13 2:00AM
pct <- seq(as.POSIXct("2011-03-12"), as.POSIXct("2011-03-17"), 
   length.out = 10)
cut(pct, breaks = "days")
cut(pct, breaks = "DSTdays")