Learn R Programming

quantmod (version 0.3-1)

weekdays.zoo: Extract Parts of a Time Series Object

Description

Extract the minute, hour, day, weekday, month or quarter. This documents the methods for the zoo class with an index of class Date, or coercible to such.

Usage

## S3 method for class 'zoo':
weekdays(x,abbreviate=FALSE)
## S3 method for class 'timeSeries':
weekdays(x,abbreviate=FALSE)

## S3 method for class 'zoo': months(x,abbreviate=FALSE) ## S3 method for class 'timeSeries': months(x,abbreviate=FALSE)

## S3 method for class 'zoo': quarters(x,abbreviate=FALSE) ## S3 method for class 'timeSeries': quarters(x,abbreviate=FALSE)

Arguments

x
a object with index that inherits Date or POSIXt
abbreviate
logical. Should names be abbreviated?

Value

  • weekdays and months return a character vector of the names, or for abbreviate=TRUE a character vector of month numbers for months.zoo.

    quarters.zoo returns a numeric vector of 1 to 4 for abbreviate=TRUE, else a character vector containing Q1,Q2,Q3, and/or Q4

See Also

DateTimeClasses, quarters, weekdays, months

Examples

Run this code
zoo.data <- zoo(rnorm(31)+10,as.Date(13514:13744,origin="1970-01-01"))
weekdays(zoo.data)
months(zoo.data)
quarters(zoo.data)

Run the code above in your browser using DataLab