seriesMerge
I want to merge two timeSeries (union) and get a resulting timeSeries. using union or merge I got a data.frame and when I tried to convert it to timeSeries the data was corrupt. Is there a more straight forward way to take two timeSeries and merege them for a resulting timeSeries of the union of both? On Thu, 25 Nov 2004 03:50:28 +0000 (UTC), Gabor Grothendieck
<ggrothendieck at myway.com> wrote:
Yasser El-Zein <abu3ammar <at> gmail.com> writes: : : Is there a function in R that is equivalent to S-PLUS's : seriesMerge(x1, x2, pos="union") : where x1, and x2 are of class timeSeries : : seriesMerge is in S-PLUS's finmetrics. I looked into R's mergeSeries : (in fSeries part of Rmetrics) but I could not make it behave quite the : same. In R it expected a timeSeries object and a matrix of the same : row count. In S-PLUS when using the union option both objects can be : of different lengths. merge.zoo in package zoo handles union, intersection, left and right join of unequal length time series according to the setting of the all= argument. zoo can also work with chron dates and times which would allow you to work with your millisecond data and can also merge more than two series at a time. (The its package (see ?itsJoin) and for regular time series, cbind.ts, also support merging unequal length series but neither of these support chron which I gather is a requirement for you.) eg. zoo example. In the following x has length 8 and y has length 6 and they overlap for chron(5:8). chron(1:4) only belongs to x and chron(9:10) only belongs to y. library(chron) library(zoo) x <- zoo(1:8, chron(1:8)) y <- zoo(5:10, chron(5:10)) merge(x,y) # union merge(x,y,all=FALSE) # intersection merge(x,y,all=c(FALSE, TRUE)) # right join merge(x,y,all=c(TRUE, FALSE)) # left join
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html