multitime: A time object with multiple time scales.

Description Usage Arguments Details Value Examples

View source: R/multitime.R

Description

Multitime objects have a primary time scale and a secondary time scale. The latter can be used to distinguish between duplicates in the primary time scale or provide an alternate representation such as specific dates that correspond to year/months.

Usage

1
2
3
4
5
multitime(x, ...)

as.multitime(x, ...)
## Default S3 method:
as.multitime(x, index, ...)

Arguments

x

Primary time scale.

index

Optional secondary time scale.

...

Other arguments passed to individual methods.

Details

Creates an object of class multitime which has a primary and possibly secondary time scale. Methods provided are: as.multitime, as.multitime.default, coredata.multitime, index.multitime, as.character.multitime, MATCH.multitime, ORDER.multitime, xtfrm.multitime, Ops.multitime, [.multitime c.multitime, as.numeric.multitime, as.Date.multitime, as.yearmon.multitime, as.yearqtr.multitime and make.unique.multitime. The primary and secondary time scales when considered in conjunction with each other must be unique if they are to be used as the times of a zoo object yet individually need not be.

as.Date, as.yearmon and as.yearqtr methods search through the time scales and return the first one found of the indicated class or if none found convert the first time scale to the indicated class.

Value

An object of class "multitime".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# use secondary time scale to uniquify times
if (require("zoo")) {
z <- zoo(1:3, as.multitime(c(1, 1, 2), c(1, 2, 1)))
z

# an object with both yearmon and Date scales
ym <- as.yearmon(2001:2003)
z2 <- zoo(1:3, as.multitime(ym, as.Date(ym, frac = 1)))
z2
as.yearmon(time(z2))
as.Date(time(z2))
}

zooExtra documentation built on May 2, 2019, 5:54 p.m.

Related to multitime in zooExtra...