Dear Horace,
seriesMerge should do the job :
> tmp <- timeSeries(data=data.frame(x=1:10))
> tmp2 <- timeSeries(data=data.frame(x=11:20))
> seriesMerge(tmp, tmp2)
Positions x.1 x.2
01/01/1960 1 11
01/02/1960 2 12
01/03/1960 3 13
01/04/1960 4 14
01/05/1960 5 15
01/06/1960 6 16
01/07/1960 7 17
01/08/1960 8 18
01/09/1960 9 19
01/10/1960 10 20
>
Regards,
Henrik
--------------------------------------------------------------------------
Henrik Aalborg Nielsen
Informatics and Mathematical Modelling
Section for Statistics, Time Series Group
Technical University of Denmark
Richard Petersens Plads, Build.321,
DK-2800 Kgs. Lyngby, Denmark.
Phone: +45 4525 3418
Fax.: +45 4588 2673
E-mail: han@imm.dtu.dk
URL: http://www.imm.dtu.dk/~han
--------------------------------------------------------------------------
On Thu, 19 Jun 2003, Horace Tso wrote:
> Hi folks,
>
> Using 6.1 under Win2K, I want to do a Union of two Time Series. Sounds
> simple? I've tried every trick out there and nothing works. SPlus support
> suggests using merge(), but that doesn't work. Each series has identical
> column names, Y1, Y2, Y3. There are some overlapping dates in both. Here they
> are,
>
> > t1
> Position Y1 Y2 Y3
> 02/12/1997 7.00 6.50 7.50
> 02/26/1997 6.50 6.25 6.75
> 02/27/1997 6.50 6.25 6.75
> 02/28/1997 6.50 6.25 6.75
> 03/01/1997 6.50 6.25 6.75
> 03/03/1997 6.50 6.25 6.75
> 03/04/1997 9.21 7.25 10.00
> 03/05/1997 10.00 9.75 10.25
> 03/06/1997 8.75 8.50 9.00
>
> >t2
> Position Y1 Y2 Y3
> 02/12/1997 6.00 8.50 7.50
> 02/26/1997 6.15 6.00 6.75
> 02/27/1997 4.50 4.25 4.75
> 02/28/1997 3.50 3.25 3.25
> 03/01/1997 6.50 6.25 6.75
> 03/04/1997 6.50 6.25 6.75
> 03/05/1997 1.21 2.25 1.00
> 03/08/1997 1.00 0.75 0.25
> 03/09/1997 2.25 2.50 2.00
>
> I want to create the following,
>
> Position Y1 Y2 Y3 Y11 Y21 Y31
> 02/12/1997 6.00 8.50 7.50 7.00 6.50 7.50
> 02/26/1997 6.15 6.00 6.75 6.50 6.25 6.75
> 02/27/1997 4.50 4.25 4.75 6.50 6.25 6.75
> 02/28/1997 3.50 3.25 3.25 6.50 6.25 6.75
> 03/01/1997 6.50 6.25 6.75 6.50 6.25 6.75
> 03/03/1997 NA NA NA 6.50 6.25 6.75
> 03/04/1997 6.50 6.25 6.75 9.21 7.25 10.00
> 03/05/1997 1.21 2.25 1.00 10.00 9.75 10.25
> 03/06/1997 NA NA NA 8.75 8.50 9.00
> 03/08/1997 1.00 0.75 0.25 NA NA NA
> 03/09/1997 2.25 2.50 2.00 NA NA NA
>
> Thanks a lot.
>
> Horace W. Tso
> Senior Quantitative Analyst
> Portland General Electric
> Portland, Oregon
> 503-464-8430 (D)
>
|