s-news
[Top] [All Lists]

[Q] Time series data

To: <s-news@lists.biostat.wustl.edu>
Subject: [Q] Time series data
From: "Tang, Roy Haicheng (Corp Credit - NY)" <RoyHaicheng_Tang@ml.com>
Date: Thu, 21 Apr 2005 11:47:33 -0400
Importance: normal
Thread-index: AcVGiW6zSmJHR2izR3uJ7MuI7Xe5Bg==
Thread-topic: [Q] Time series data

Hi all,

I just started to use time series in Splus and have a couple of questions on timeSeries and seriesMerge. I have some time series data like this:

DATE            USD1    USD2    USD3
4/10/2001       37.3    34.3    65.3
4/11/2001       81.2    20.2    62.1
4/12/2001       65.3    49.2    36.2
4/16/2001       91.8    83.4    26.8
4/17/2001       0.4     14.9    32.6
4/18/2001       32.6    74.0    56.5
4/19/2001       55.4    79.8    12.8
4/20/2001       65.3    35.6    69.8
4/23/2001       13.0    65.6    16.8
4/24/2001       55.0    19.6    50.0
4/25/2001       34.5    78.2    42.3
4/26/2001       38.6    5.6     85.4

If I read it using
y1<-timeSeries(DATA1[,(2:4)],DATA1[,1])

I get a nice timeSeries in Splus in nice form. Each time series has its name (USD1, USD2…) attached. But if I only read 1 time series, say,

y1<-timeSeries(DATA1[,2],DATA1[,1])

The column name (or series name) becomes "1". This poses problem when I tried to use mergeSeries to merge multiple time series, some of which have column names and some of them only has "1"  as column name (or series name). e.g., if TEST1 is a (multi-variate) time series with proper series names and TEST2,TEST3 are both single time series with "1" as series name, the following command will not work:

> TEMP_seriesMerge(TEST1,TEST2,TEST3,pos="union",how="NA")
Problem in "dimnames<-.data.frame"(x, dn): column names must be unique
Use traceback() to see the call stack

My question is:  how can I add series name to the two series with "1" as series name; or use some other approach to merge the series?

Any help is appreciated.

Thanks!
-Roy


If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail.     http://www.ml.com/email_terms/

<Prev in Thread] Current Thread [Next in Thread>