Learn R Programming

zoo: S3 Infrastructure for Regular and Irregular Time Series

Overview

The R package zoo provides an S3 class zoo for working with regular and irregular time series. The class stores data as numeric vectors/matrices (or factors) along with a time index which can be of arbitrary class (including numeric, Date, POSIXct, chron, yearmon, yearqtr). Functions and methods for zoo are consistent with the ts class and base R and also extend standard generics. Tools include:

  • Data import/export and coercion to and from other time series classes (ts, xts, timeSeries, etc.).
  • Visualization using different engines (base R, ggplot2, lattice, tinyplot).
  • Alignment and merging of series recorded at different time indexes.
  • Aggregation to coarser time intervals.
  • Lags and subsets.
  • Rolling analytics over moving time windows.
  • Time-based interpolation and filling.

Installation

The stable version of zoo is available from CRAN:

install.packages("zoo")

The latest development version can be installed from R-universe:

install.packages("zoo", repos = "https://zeileis.R-universe.dev")

License

The package is available under the General Public License version 3 or version 2

Citation

Zeileis A, Grothendieck G (2005). “zoo: S3 Infrastructure for Regular and Irregular Time Series.” Journal of Statistical Software, 14(6), 1-27. doi:10.18637/jss.v014.i06

Copy Link

Version

Install

install.packages('zoo')

Monthly Downloads

817,632

Version

1.9-0

License

GPL-2 | GPL-3

Maintainer

Achim Zeileis

Last Published

July 31st, 2026

Functions in zoo (1.9-0)

zooreg

Regular zoo Series
tinyplot.zoo

Plotting zoo Objects with tinyplot
yearqtr

An Index Class for Quarterly Data
window.zoo

Extract/Replacing the Time Windows of Objects
yearmon

An Index Class for Monthly Data
xblocks

Plot contiguous blocks along x axis.
zoo

Z's Ordered Observations
rollmean

Rolling Means/Maximums/Medians/Sums
rollapply

Apply Rolling Functions
xyplot.zoo

Plot zoo Series with Lattice
coredata

Extracting/Replacing the Core Data of Objects
ggplot2.zoo

Convenience Functions for Plotting zoo Objects with ggplot2
ORDER

Ordering Permutation
na.approx

Replace NA by Interpolation
na.fill

Fill NA or Specified Positions
plot.zoo

Plotting zoo Objects
lag.zoo

Lags and Differences of zoo Objects
na.trim

Trim Leading/Trailing Missing Observations
index

Extracting/Replacing the Index of Objects
na.StructTS

Replace NA by Kalman Filter
is.regular

Check Regularity of a Series
na.aggregate

Replace NA by Aggregation
merge.zoo

Merge Two or More zoo Objects
read.zoo

Reading and Writing zoo Series
na.locf

Last Observation Carried Forward
make.par.list

Make a List from a Parameter Specification
frequency<-

Replacing the Index of Objects
MATCH

Value Matching
as.zoo

Coercion from and to zoo
aggregate.zoo

Compute Summary Statistics of zoo Objects