seriesMerge
Merging for Time Series and Signals

Description

Merges time series or signal objects, making a new object with all the columns of the input objects, and some or all of the rows, depending on how their positions match.

Usage

seriesMerge(x1, x2, ..., pos=positions(x1), how,
        error.how, localzone=FALSE, matchtol=0,  
        suffixes)

Arguments

x1 the first object to be merged.
x2 the second object to be merged.
... the other objects to be merged.
pos the positions to align to, or "union" to make a union of all input positions. (The default argument values give an intersection of all the positions.)
how after the positions to align to are determined, how determines how to treat positions that are missing from the various input objects.

Can be one of the following:

"NA" Inserts a row of NA.
"drop" Drops that position entirely.
"nearest" Uses the row with the nearest position.
"before" Uses the data from the row whose position is just before the unmatched position.
"after" Uses the data from the row whose position is just after the unmatched position.
"interp" Interpolates linearly between "before" and "after".
The default is "drop" unless pos="union", in which case "drop" makes no sense and the default is "NA".
error.how specifies what to do in the event of an out of bounds error, which can occur when how is "before", "after", or "interp".

Can be one of the following:

"NA" Inserts a row of NA
"drop" Drops that position entirely
"nearest" Uses the row with the nearest position.
The default is "drop" unless pos="union", in which case "drop" makes no sense and the default is "NA".
localzone if TRUE (that is, all input positions must be calendar-based), merge by matching/interpolating with all positions in their local time zones, instead of with the absolute GMT times.
matchtol the tolerance for matching positions. Positions that match within matchtol do not invoke how argument methods.
suffixes the suffixes to append to the column names that are duplicated between the various input data objects. The default value is paste(".", 1:nargs, sep = ""), where nargs is the total number of data arguments.
Value
returns a new series object containing all the columns of all the inputs, and all the rows of all the inputs, according to the alignment methods described above.
See Also
timeSeries, signalSeries, positions, align, merge.
Examples
a <- signalSeries(pos=1:10, data=data.frame(a = 11:20, b = 5 * (1:10))) 
b <- signalSeries(pos=5:14, data=data.frame(a = 11:20, b = 5 * (1:10))) 
seriesMerge(a, b) 
a <- timeSeries(pos=as(1:10, "timeDate"), 
		data=data.frame(a = 11:20, b = 5 * (1:10))) 
b <- timeSeries(pos=as(5:14, "timeDate"), 
	        data=data.frame(a = 11:20, b = 5 * (1:10))) 
seriesMerge(a, b, pos="union") 
Package splusTimeSeries version 6.1.1-7
Package Index