spliceZoos: Splice 'zoo's

Description Usage Arguments Details Value Examples

Description

Splice zoos together.

Usage

1
spliceZoos(x, y)

Arguments

x

First input zoo (takes precendence)

y

First input zoo

Details

Splices y into x, with x taking precedence. If y only introduces a new series, then it works just like a 'merge'.

spliceZoos uses the input's column names to find common series, then merges series "end-to-end" into a single series that may come from both inputs. This is useful, for example, if series come from different data sources but are different instances of the same underlying series. If there are additional columns in the inputs that are not in-common, merges those as normal. If there are not columns in-common, the function acts simply as a regular merge.

Value

A zoo with the spliced output

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(zoo)

dts1 <- seq(as.Date("2012-08-01"), as.Date("2013-09-30"), "days")

nr <- length(dts1)
z1 <- zoo(matrix(rnorm(nr*4), nr, 4), dts1)
colnames(z1) <- paste("S", 1:4, sep="")

dts4 <- seq(as.Date("2013-10-01"), as.Date("2013-11-01"), "days")
nr <- length(dts4)
z4 <- zoo(matrix(rnorm(nr), nrow=nr), dts4)
colnames(z4) <- 'S4'

allser <- spliceZoos(z1, z4)

pchristi99/pcLib documentation built on June 25, 2019, 2:23 p.m.