08.12.2012 Views

Package 'zoo' - CRAN

Package 'zoo' - CRAN

Package 'zoo' - CRAN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

16 merge.zoo<br />

merge.zoo Merge Two or More zoo Objects<br />

Description<br />

Usage<br />

Merge two zoo objects by common indexes (times), or do other versions of database join operations.<br />

## S3 method for class ’zoo’<br />

merge(..., all = TRUE, fill = NA, suffixes = NULL,<br />

check.names = FALSE, retclass = c("zoo", "list", "data.frame"),<br />

drop = TRUE)<br />

Arguments<br />

Details<br />

... two or more objects, usually of class "zoo".<br />

all logical vector having the same length as the number of "zoo" objects to be<br />

merged (otherwise expanded).<br />

fill an element for filling gaps in merged "zoo" objects (if any).<br />

suffixes character vector of the same length as the number of "zoo" objects specifying<br />

the suffixes to be used for making the merged column names unique.<br />

check.names See link{read.table}.<br />

retclass character that specifies the class of the returned result. It can be "zoo" (the<br />

default), "list" or NULL. For details see below.<br />

drop logical. If a "zoo" object without observations is merged with a one-dimensional<br />

"zoo" object (vector or 1-column matrix), should the result be a vector (drop = TRUE)<br />

or a 1-column matrix (drop = FALSE)? The former is the default in the Merge<br />

method, the latter in the cbind method.<br />

The merge method for "zoo" objects combines the columns of several objects along the union of<br />

the dates for all = TRUE, the default, or the intersection of their dates for all = FALSE filling up<br />

the created gaps (if any) with the fill pattern.<br />

The first argument must be a zoo object. If any of the remaining arguments are plain vectors or<br />

matrices with the same length or number of rows as the first argument then such arguments are<br />

coerced to "zoo" using as.zoo. If they are plain but have length 1 then they are merged after all<br />

non-scalars such that their column is filled with the value of the scalar.<br />

all can be a vector of the same length as the number of "zoo" objects to merged (if not, it is<br />

expanded): All indexes (times) of the objects corresponding to TRUE are included, for those corresponding<br />

to FALSE only the indexes present in all objects are included. This allows intersection,<br />

union and left and right joins to be expressed.<br />

If retclass is "zoo" (the default) a single merged "zoo" object is returned. If it is set to "list"<br />

a list of "zoo" objects is returned. If retclass = NULL then instead of returning a value it updates

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!