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.
seriesMerge
4 messages · Yasser El-Zein, Dirk Eddelbuettel, Gabor Grothendieck
On Wed, Nov 24, 2004 at 03:29:53PM -0500, Yasser El-Zein wrote:
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.
The its (short for irregular timeseries) package has union() and intersect(). The zoo package also some functions for this, I think. Topics like this get discussed a bit on the r-sig-finance list, you may want to glance at the archives or do some conditional googleing. Hth, Dirk
If your hair is standing up, then you are in extreme danger.
-- http://www.usafa.af.mil/dfp/cockpit-phys/fp1ex3.htm
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
5 days later
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