zoo {zoo} | R Documentation |
zoo
is the creator for an S3 class of indexed
totally ordered observations which includes irregular
time series.
zoo(x = NA, order.by = index(x))
x |
a vector or matrix. |
order.by |
a vector by which the observations in x
are ordered. |
zoo
is still under development, but it provides plot
and index
(or time
) methods for "zoo"
objects
and can convert "ts"
and "irts"
objects with
as.zoo
.
The vector of indexes order.by
can be of arbitrary class,
but it is essential that order(order.by)
works. For other
functions it is assumed that c()
, length()
,
match()
and subsetting [,
work.
If x
is shorter or longer than order.by
it is
expanded accordingly.
A vector or matrix with an "index"
attribute of the same
dimension (NROW(x)
) by which x
is ordered.
## simple creation and plotting x.date <- as.POSIXct(paste("2003-02-", c(1, 3, 7, 9, 14), sep = "")) x <- zoo(rnorm(5), x.date) plot(x) time(x) ## subsetting x[1:3] # create a constant series z <- zoo(1, seq(4)[-2]) # create a series with zero columns z0 <- zoo(, 1:4)[,-1]