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

707,886

Version

1.9-1

License

GPL-2 | GPL-3

Maintainer

Achim Zeileis

Last Published

September 25th, 2026

Functions in zoo (1.9-1)

merge.zoo

Merge Two or More zoo Objects
plot.zoo

Plotting zoo Objects
rollmean

Rolling Means/Maximums/Medians/Sums
window.zoo

Extract/Replacing the Time Windows of Objects
xblocks

Plot Contiguous Blocks along x Axis
tinyplot.zoo

Plotting zoo Objects with tinyplot
yearmon

An Index Class for Monthly Data
yearqtr

An Index Class for Quarterly Data
read.zoo

Reading and Writing zoo Series
rollapply

Apply Rolling Functions
xyplot.zoo

Plot zoo Series with Lattice
zoo

Z's Ordered Observations
zooreg

Regular zoo Series
zoo-methods

Fully Exported zoo Methods
coredata

Extracting/Replacing the Core Data of Objects
ggplot2.zoo

Convenience Functions for Plotting zoo Objects with ggplot2
aggregate.zoo

Compute Summary Statistics of zoo Objects
as.zoo

Coercion from and to zoo and zooreg
make.par.list

Make a List from a Parameter Specification
lag.zoo

Lags and Differences of zoo Objects
is.regular

Check Regularity of a Series
frequency<-

Replacing the Index of Objects
na.trim

Trim Leading/Trailing Missing Observations
index

Extracting/Replacing the Index of Objects
na.fill

Fill NA or Specified Positions
na.StructTS

Replace NA by Kalman Filter
na.approx

Replace NA by Interpolation
MATCH

Value Matching
as.Date

Coercion to the Date Class
na.aggregate

Replace NA by Aggregation
na.locf

Last Observation Carried Forward
ORDER

Ordering Permutation
lattice-deprecated

Deprecated Time Series Panel Methods for Lattice