weeks {quantmod}R Documentation

Extract Weeks, Years of a Time Series Object

Description

Extract weeks and years. This is a generic function, methods for zoo classes are documented here

Usage

## S3 method for class 'zoo':
weeks(x, abbreviate)

## S3 method for class 'zoo':
years(x, abbreviate)

Arguments

x zoo object with index of class Date
abbreviate abbreviate the results

Details

Behaves exactly as weekdays, months and quarters from base with the obvious difference in that the method extracts the weeks or years of the object.

Value

A numeric vector giving the week number of the year corresponding to each observed date for weeks, and year in CCYY-MM-DD format for years.

Note

The zoo object's index must be of class Date, or coercible to such.

Author(s)

Jeffrey A. Ryan

References

zoo

See Also

weekdays, Date

Examples

zoo.data <- zoo(rnorm(31)+10,as.Date(13514:13744,origin="1970-01-01"))
weeks(zoo.data)
years(zoo.data)

[Package quantmod version 0.3-4 Index]