Learn R Programming

quantmod (version 0.3-3)

minutes: Extract Minutes, Hours, or Days of a High Frequency Time Series Object

Description

Extract the minutes or hours of a day, or days since the beginning of the year This function is a generic, with currently a single method implemented for objects of class zoo.

Usage

## S3 method for class 'zoo':
seconds(x,k=1,...)

seconds(x,k=1,...)

## S3 method for class 'zoo': minutes(x,k=1,...)

minutes(x,k=1,...) minutes3(x,...) minutes5(x,...) minutes10(x,...) minutes15(x,...) minutes30(x,...)

## S3 method for class 'zoo': hours(x,...)

## S3 method for class 'zoo': days(x,...)

Arguments

x
zoo object with index of class Date
k
used to identify which bar obs. belongs to
...
additional unused arguments

Value

  • minutes returns the minute of the day as a character [0-59]

    hours returns the hour of the day as a character [0-23]

    days returns the day of the year as a character [001-366]

Details

Behaves exactly as weekdays, months and quarters from base with the obvious difference in that the method extracts the minutes or hours of a day, and day of the year for a given object.

minutes3, minutes5, minutes10, minutes15, minutes30 are wrappers to the appropriate minutes time scale.

See Also

weekdays, Date, POSIXlt,

Examples

Run this code
start.time <- as.POSIXlt("2004-12-31 00:08:30")
minute.data <- zoo(rnorm(251),seq(start.time,start.time+15000,by=60))
minutes(minute.data)
minutes5(minute.data)
hours(minute.data)
days(minute.data)

Run the code above in your browser using DataLab