Return Various Periods from a Dates Object

DESCRIPTION:
Create an ordered factor from a vector of dates according to various calendar periods.

USAGE:
days(x)
weekdays(x, abb=T)
months(x, abb=T)
quarters(x, abb=T)
years(x)

REQUIRED ARGUMENTS:
x:
a dates object.

OPTIONAL ARGUMENTS:
abb:
logical flag telling whether abbreviations should be returned for days of the week, month names, or quarters. Default is TRUE.

VALUE:
an ordered factor corresponding to days, weekdays, months, quarters, or years of x for the respective function.

DETAILS:
the levels of days are the days of the month, 1 through 31; the levels of weekdays are Sunday through Saturday; the levels of months are January through December; and the levels of quarters are I < II < III < IV if abb=F and 1Q < 2Q < 3Q < 4Q if abb=T. The levels of years are exactly the years of the dates in x---years in the range of x that are not in x itself are not interpolated.

SEE ALSO:
dates , julian , plot .

EXAMPLES:
# creates a sample dates object of julian dates
x <- c(10,11,12,42,44,45,101,102,212,213,214,300)
dts <- dates(x)

# identifies a weekday or month with each julian day weekdays(dts) months(dts)

# produces barplot of # of days in x appearing on particular # weekday or month plot(weekdays(dts)) plot(months(dts))

# produces boxplots of julian date by weekday or month plot(weekdays(dts), x) plot(months(dts), x)