cut.dates(x, breaks, labels, start.on.monday = T, include.lowest = F)
dates), or vector of character string in the dates format
"m/d/y", or vector of integers representing Julian dates.
x),
a constant specifying number of equally spaced intervals extending from
min(x)-1 to
max(x)+1, or one of the strings
"days",
"weeks",
"months",
"year" specifying a time period.
TRUE, indicates that weeks start on Mondays.
Set to
FALSE if weeks start on Sundays; for other days of the week
specify the corresponding number: Sunday == 0, Monday == 1,
Tuesday == 2, ..., Saturday == 6.
TRUE, the lowest bin includes its lower endpoint. If
FALSE (the default), the lowest bin acts like the others, which include
the upper endpoint but not the lower.
This is a method for the function
cut, that is,
cut(x) will call
cut.dates
whenever
x is a dates object.
# days from 07/01/92 thru 07/15/92 fell into 3 Monday-started weeks
cut(dates("07/01/92") + 0:14, "weeks")
# Produces:
# [1] week 1 week 1 week 1 week 1 week 1 week 2 week 2 week 2
# [9] week 2 week 2 week 2 week 2 week 3 week 3 week 3
# week 1 < week 2 < week 3
# create a string vector containing dates data
opened <- dates(c("3/17/92", "3/15/92", "1/21/92", "3/1/92", "1/27/92",
"1/22/92", "2/12/92", "2/18/92", "2/8/92", "3/13/92"),
format = c("m/d/y"))
cut(opened, "months")
# produces the following output:
# [1] Mar 92 Mar 92 Jan 92 Mar 92 Jan 92 Jan 92 Feb 92 Feb 92 Feb 92 Mar 92
# Jan 92 < Feb 92 < Mar 92
# distribution (boxplots) by months
plot(cut(opened, "months"))