Learn R Programming

quantmod (version 0.2-5)

weeks: Extract Weeks, Years of a Time Series Object

Description

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

Usage

weeks(x, abbreviate)

years(x, abbreviate)

Arguments

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

Value

  • A numeric vector giving the week number corresponding to each observed date for weeks, and year for years.

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.

References

zoo

See Also

weekdays, Date

Examples

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

Run the code above in your browser using DataLab