Package: zoo 1.8-16

Achim Zeileis

zoo: S3 Infrastructure for Regular and Irregular Time Series (Z's Ordered Observations)

An S3 class with methods for totally ordered indexed observations. It is particularly aimed at irregular time series of numeric vectors/matrices and factors. zoo's key design goals are independence of a particular index/date/time class and consistency with ts and base R by providing methods to extend standard generics.

Authors:Achim Zeileis [aut, cre], Gabor Grothendieck [aut], Jeffrey A. Ryan [aut], Joshua M. Ulrich [ctb], Felix Andrews [ctb]

zoo_1.8-16.tar.gz
zoo_1.8-16.zip(r-4.7)zoo_1.8-16.zip(r-4.6)zoo_1.8-16.zip(r-4.5)
zoo_1.8-16.tgz(r-4.6-x86_64)zoo_1.8-16.tgz(r-4.6-arm64)zoo_1.8-16.tgz(r-4.5-x86_64)zoo_1.8-16.tgz(r-4.5-arm64)
zoo_1.8-16.tar.gz(r-4.7-arm64)zoo_1.8-16.tar.gz(r-4.7-x86_64)zoo_1.8-16.tar.gz(r-4.6-arm64)zoo_1.8-16.tar.gz(r-4.6-x86_64)
zoo_1.8-16.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
zoo/json (API)

# Install 'zoo' in R:
install.packages('zoo', repos = c('https://r-forge.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://r-forge.r-project.org/projects/zoo

On CRAN:

Conda:

16.56 score 3.0k packages 40k scripts 835k downloads 45 mentions 122 exports 1 dependencies

Last updated from:ed940e9291. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK158
linux-devel-x86_64OK172
source / vignettesOK264
linux-release-arm64OK168
linux-release-x86_64OK149
macos-release-arm64OK106
macos-release-x86_64OK476
macos-oldrel-arm64OK135
macos-oldrel-x86_64OK338
windows-develOK100
windows-releaseOK136
windows-oldrelOK97
wasm-releaseOK215

Exports:as.Dateas.Date.numericas.Date.tsas.Date.yearmonas.Date.yearqtras.yearmonas.yearmon.defaultas.yearqtras.yearqtr.defaultas.zooas.zoo.defaultas.zooregas.zooreg.defaultautoplot.zoocbind.zoocoredatacoredata.defaultcoredata<-facet_freeformat.yearqtrfortify.zoofrequency<-ifelse.zooindexindex<-index2charis.regularis.zoomake.par.listMATCHMATCH.defaultMATCH.timesmedian.zoomerge.zoona.aggregatena.aggregate.defaultna.approxna.approx.defaultna.fillna.fill.defaultna.fill0na.locfna.locf.defaultna.locf0na.splinena.spline.defaultna.StructTSna.trimna.trim.defaultna.trim.tsORDERORDER.defaultpanel.lines.itspanel.lines.tispanel.lines.tspanel.lines.zoopanel.plot.custompanel.plot.defaultpanel.points.itspanel.points.tispanel.points.tspanel.points.zoopanel.polygon.itspanel.polygon.tispanel.polygon.tspanel.polygon.zoopanel.rect.itspanel.rect.tispanel.rect.tspanel.rect.zoopanel.segments.itspanel.segments.tispanel.segments.tspanel.segments.zoopanel.text.itspanel.text.tispanel.text.tspanel.text.zooplot.zooquantile.zoorbind.zooread.csv.zooread.csv2.zooread.delim.zooread.delim2.zooread.table.zooread.zoorev.zoorollapplyrollapplyrrollmaxrollmax.defaultrollmaxrrollmeanrollmean.defaultrollmeanrrollmedianrollmedian.defaultrollmedianrrollsumrollsum.defaultrollsumrscale_type.yearmonscale_type.yearqtrscale_x_yearmonscale_x_yearqtrscale_y_yearmonscale_y_yearqtrSys.yearmonSys.yearqtrtime<-tinyplot.zoowrite.zooxblocksxblocks.defaultxtfrm.zooyearmonyearmon_transyearqtryearqtr_transzoozooreg

Dependencies:lattice

zoo Design

Last update: 2026-02-15
Started: 2012-04-28

zoo FAQ
1. I know that duplicate times are not allowed but my data has them. What do I do? | 2. When I try to specify a log axis to plot.zoo a warning is issued. What is wrong? | 3. How do I create right and a left vertical axes in plot.zoo? | 4. I have data frame with both numeric and factor columns. How do I convert that to a "zoo" object? | 5. Why does lag give slightly different results on a "zoo" and a "zooreg" series which are otherwise the same? | 6. How do I subtract the mean of each month from a "zoo" series? | 7. How do I create a monthly series but still keep track of the dates? | 8. How are axes added to a plot created using plot.zoo? | 9. Why is nothing plotted except axes when I plot an object with many NAs? | 10. Does zoo work with Rmetrics? | 11. What other packages use zoo? | 12. Why does ifelse not work as I expect? | 13. In a series which is regular except for a few missing times or for which we wish to align to a grid how is it filled in or aligned? | 14. What is the difference between as.Date in zoo and as.Date in the core of R? | 15. How can I speed up zoo?

Last update: 2026-02-15
Started: 2012-04-28

Reading Data in zoo

Last update: 2025-04-09
Started: 2012-04-28

zoo Quick Reference
Read a series from a text file | Query dates | Convert back into a plain matrix | Union and intersection | Visualization | Select (a few) observations | Handle missing data | Prices and returns | Query Yahoo! Finance | Summaries

Last update: 2025-04-08
Started: 2012-04-28

zoo: An S3 Class and Methods for Indexed Totally Ordered Observations
Introduction | The class "zoo" and its methods | Combining zoo with other packages | Summary and outlook | Reference card

Last update: 2025-04-08
Started: 2012-04-28

Readme and manuals

Help Manual

Help pageTopics
Compute Summary Statistics of zoo Objectsaggregate.zoo split.zoo
Coercion from and to zooas.data.frame.zoo as.list.ts as.list.zoo as.matrix.zoo as.ts.zoo as.vector.zoo as.zoo as.zoo.data.frame as.zoo.default as.zoo.fts as.zoo.irts as.zoo.its as.zoo.matrix as.zoo.mcmc as.zoo.tis as.zoo.ts as.zoo.xts as.zoo.zoo
Extracting/Replacing the Core Data of Objectscoredata coredata.default coredata.irts coredata.its coredata.ts coredata.zoo coredata<- coredata<-.irts coredata<-.its coredata<-.ts coredata<-.zoo
Replacing the Index of Objectsfrequency<- frequency<-.zoo frequency<-.zooreg
Convenience Functions for Plotting zoo Objects with ggplot2autoplot.zoo facet_free fortify.zoo ggplot2.zoo scale_type.yearmon scale_type.yearqtr scale_x_yearmon scale_x_yearqtr scale_y_yearmon scale_y_yearqtr yearmon_trans yearqtr_trans
Extracting/Replacing the Index of Objectsend.zoo index index.default index.ts index.zoo index<- index<-.zoo start.zoo time.zoo time<- time<-.zoo
Check Regularity of a Seriesis.regular is.regular.default is.regular.ts is.regular.zoo is.regular.zooreg
Lags and Differences of zoo Objectsdiff.zoo lag.zoo
Make a List from a Parameter Specificationmake.par.list
Value MatchingMATCH MATCH.Date MATCH.default MATCH.POSIXct MATCH.POSIXlt MATCH.timeDate MATCH.times
Merge Two or More zoo Objectsc.zoo cbind.zoo merge.zoo rbind.zoo
Replace NA by Aggregationna.aggregate na.aggregate.default
Replace NA by Interpolationna.approx na.approx.default na.approx.ts na.approx.zoo na.approx.zooreg na.spline na.spline.default na.spline.ts na.spline.zoo na.spline.zooreg
Fill NA or specified positions.na.fill na.fill.default na.fill.ts na.fill.zoo na.fill0
Last Observation Carried Forwardna.locf na.locf.data.frame na.locf.default na.locf.list na.locf0
Fill NA or specified positions.na.StructTS na.StructTS.ts na.StructTS.zoo
Trim Leading/Trailing Missing Observationsna.trim na.trim.default na.trim.ts
Ordering PermutationORDER ORDER.default
Plotting zoo Objectsbarplot.zoo boxplot.zoo lines.zoo plot.zoo points.zoo
Reading and Writing zoo Seriesread.csv.zoo read.csv2.zoo read.delim.zoo read.delim2.zoo read.table.zoo read.zoo write.zoo
Apply Rolling Functionsrollapply rollapply.default rollapply.ts rollapply.zoo rollapplyr
Rolling Means/Maximums/Medians/Sumsrollmax rollmax.default rollmax.ts rollmax.zoo rollmaxr rollmean rollmean.default rollmean.ts rollmean.zoo rollmeanr rollmedian rollmedian.default rollmedian.ts rollmedian.zoo rollmedianr rollsum rollsum.default rollsum.ts rollsum.zoo rollsumr
Plotting zoo Objects with tinyplottinyplot.zoo
Extract/Replacing the Time Windows of Objectswindow.zoo window<-.zoo
Plot contiguous blocks along x axis.xblocks xblocks.default xblocks.ts xblocks.zoo
Plot zoo Series with Latticellines.its llines.tis llines.zoo lpoints.its lpoints.tis lpoints.zoo ltext.its ltext.tis ltext.zoo panel.lines.its panel.lines.tis panel.lines.ts panel.lines.zoo panel.plot.custom panel.plot.default panel.points.its panel.points.tis panel.points.ts panel.points.zoo panel.polygon.its panel.polygon.tis panel.polygon.ts panel.polygon.zoo panel.rect.its panel.rect.tis panel.rect.ts panel.rect.zoo panel.segments.its panel.segments.tis panel.segments.ts panel.segments.zoo panel.text.its panel.text.tis panel.text.ts panel.text.zoo xyplot.its xyplot.tis xyplot.zoo
An Index Class for Monthly Data-.yearmon as.character.yearmon as.data.frame.yearmon as.Date as.Date.numeric as.Date.ts as.Date.yearmon as.list.yearmon as.numeric.yearmon as.POSIXct.yearmon as.POSIXlt.yearmon as.yearmon as.yearmon.character as.yearmon.Date as.yearmon.date as.yearmon.dates as.yearmon.default as.yearmon.factor as.yearmon.integer as.yearmon.jul as.yearmon.numeric as.yearmon.POSIXt as.yearmon.timeDate c.yearmon cycle.yearmon format.yearmon is.numeric.yearmon MATCH.yearmon mean.yearmon Ops.yearmon print.yearmon range.yearmon Summary.yearmon summary.yearmon Sys.yearmon unique.yearmon xtfrm.yearmon yearmon [.yearmon [[.yearmon
An Index Class for Quarterly Data-.yearqtr as.character.yearqtr as.data.frame.yearqtr as.Date.yearqtr as.list.yearqtr as.numeric.yearqtr as.POSIXct.yearqtr as.POSIXlt.yearqtr as.yearqtr as.yearqtr.character as.yearqtr.Date as.yearqtr.date as.yearqtr.dates as.yearqtr.default as.yearqtr.factor as.yearqtr.integer as.yearqtr.jul as.yearqtr.numeric as.yearqtr.POSIXt as.yearqtr.timeDate as.yearqtr.yearqtr c.yearqtr cycle.yearqtr format.yearqtr is.numeric.yearqtr MATCH.yearqtr mean.yearqtr Ops.yearqtr print.yearqtr range.yearqtr Summary.yearqtr summary.yearqtr Sys.yearqtr unique.yearqtr xtfrm.yearqtr yearqtr [.yearqtr [[.yearqtr
Z's Ordered Observations$.zoo $<-.zoo as.zoo.factor cummax.zoo cummin.zoo cumprod.zoo cumsum.zoo dim<-.zoo head.zoo ifelse.zoo index2char index2char.default index2char.numeric index2char.POSIXt is.zoo mean.zoo median.zoo na.contiguous na.contiguous.data.frame na.contiguous.default na.contiguous.list na.contiguous.zoo names.zoo names<-.zoo Ops.zoo print.zoo quantile.zoo range.zoo rev.zoo scale.zoo str.zoo subset.zoo summary.zoo t.zoo tail.zoo transform.zoo with.zoo xtfrm.zoo zoo [.zoo [<-.zoo
Regular zoo Seriesas.ts.zooreg as.zoo.zooreg as.zooreg as.zooreg.default as.zooreg.its as.zooreg.ts as.zooreg.xts as.zooreg.zoo cycle.zoo cycle.zooreg deltat.zoo deltat.zooreg frequency.zoo frequency.zooreg index<-.zooreg lag.zooreg time<-.zooreg zooreg