Creation
-
zoo(x, order.by): Creation of a
"zoo"object from the observationsx(a vector or a matrix) and an indexorder.byby which the observations are ordered.For computations on arbitrary index classes, methods to the following generic functions are assumed to work: combining
c(), querying lengthlength(), subsetting[, orderingORDER()and value matchingMATCH(). For pretty printing anas.characterand/orindex2charmethod 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 frequencyfreqcomplies with the indexorder.by. Anas.numericmethod 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 asts(). |
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".
Extracting and replacing data and index
- index, time: Extract the index of a series.
- index<-, time<-: Replace the index of a series.
-
coredata,
coredata<-: Extract and replace the data associated with a
"zoo"object. - lag: Lagged observations.
- diff: Arithmetic and geometric differences.
- start, end: Querying start and end of a series.
-
window,
window<-: Subsetting of
"zoo"objects using their index.
NA handling
-
na.omit: Omit
NAs. -
na.contiguous:
Compute longest sequence of non-
NAobservations. -
na.fill:
Impute
NAs by filling gaps with specific values. -
na.locf:
Impute
NAs by carrying forward the last observation. -
na.approx,
na.spline: Impute
NAs by interpolation. -
na.trim:
Remove leading and/or trailing
NAs.
Rolling analytics
- rollapply: Apply a function to rolling margin of an array.
-
rollmean:
More efficient functions for computing the rolling mean, median and
maximum are
rollmean(),rollmedian()androllmax(), respectively.
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.