days
Return Various Periods from a Time or Date Object

### Description

Creates an ordered factor from a vector of dates according to various calendar periods.

### Usage

    days(x)
    weekdays(x, abbreviate = TRUE)
    months(x, abbreviate = TRUE)
    quarters(x, abbreviate = TRUE)
    years(x)

### Arguments

x | a dates object.
abbreviate | a logical flag. If TRUE, abbreviations should be returned for days of the week, month names, or quarters. Default is TRUE.

### 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.
- The levels of quarters are I < II < III < IV if abb=F and 1Q < 2Q < 3Q < 4Q if abbreviate=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.

These functions are generic.
The default method works on dates objects and other objects that can be coerced to dates objects.
There are also methods for timeDate, which take weekday and month names and abbreviations from timeDateOptions(c("time.day.name", "time.day.abb", "time.month.name", "time.month.abb")).
Value
returns an ordered factor corresponding to days, weekdays, months, quarters, or years of x for the respective function.
See Also
as.Date, julian, timeDate, hours, yeardays, hms
Examples

    ## Creates a sample dates object of julian dates
    x <- c(10, 11, 12, 42, 44, 45, 101, 102, 212, 213, 214, 300)
    dts <- as.Date(x, origin="1960-1-1")
    ## Alternatively, create a sample timeDate object
    dts <- as(x, "timeDate")
    ## 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)

Package splusTimeDate version 6.1.5-18
Package Index