Skip to contents

Creation

  • zoo(x, order.by): Creation of a "zoo" object from the observations x (a vector or a matrix) and an index order.by by which the observations are ordered.

    For computations on arbitrary index classes, methods to the following generic functions are assumed to work: combining c(), querying length length(), subsetting [, ordering ORDER() and value matching MATCH(). For pretty printing an as.character and/or index2char method might be helpful.

Creation of regular series

  • zoo(x, order.by, freq): Works as above but creates a "zooreg" object which inherits from "zoo" if the frequency freq complies with the index order.by. An as.numeric method has to be available for the index class.
  • zooreg(x, start, end, freq): Creates a "zooreg" series with a numeric index as above and has (almost) the same interface as ts(). |

Standard methods

Import/export

  • read.zoo: Reads "zoo" objects from text files, e.g., in CSV format (comma-separated values).
  • write.zoo: Writes "zoo" objects to text files such, e.g., in CSV format.

Coercion

  • as.zoo: Coercion to "zoo" is available for objects of class "ts", "xts", "timeSeries", and many others.
  • as.class.zoo: Coercion from "zoo" to other classes. Includes methods for class in "matrix", "vector", "data.frame", "list", "ts", "xts", "timeSeries", and several others.
  • is.zoo: Querying wether an object is of class "zoo".

Merging and binding

  • merge: Union, intersection, left join, right join along indexes.
  • cbind: Column binding along the intersection of the index.
  • c, rbind: Combining/row binding (indexes may not overlap).
  • aggregate: Compute summary statistics along a coarser grid of indexes

Mathematical operations

  • Ops: Group generic functions performed along the intersection of indexes.
  • t: Transposing (coerces to "matrix" before).
  • cumsum: Compute (columnwise) cumulative quantities: sums cumsum(), products cumprod(), maximum cummax(), minimum cummin().

Extracting and replacing data and index

NA handling

Rolling analytics

Methods for regular series

  • is.regular: Checks whether a series is weakly (or strictly if strict = TRUE) regular.
  • frequency, deltat: Extracts the frequency or its reciprocal value respectively from a series, for "zoo" series the functions try to determine the regularity and frequency in a data-driven way.
  • cycle: Gives the position in the cycle of a regular series.

Time classes for monthly and quarterly data

  • yearmon: Time index class for monthly data.
  • yearqtr: Time index class for quarterly data.