s-news
[Top] [All Lists]

how to generate indexed 3-dim variable

To: <s-news@lists.biostat.wustl.edu>
Subject: how to generate indexed 3-dim variable
From: "Brian Wu" <bwu@guzman.com>
Date: Wed, 25 Jan 2006 13:46:25 -0500
Thread-index: AcYh36UWuuo5otCURAqRnqhQVHcV/Q==
Thread-topic: [S] how to generate indexed 3-dim variable
Anyone know simple functions which can generate 3 dimentions indexed variable?

Currently, I am using a list storing the data.
A list variable (data<-list()) which contain some data.frame.
Can I use this list as a 3-dim matrix? 
What if I wanna a vector with data of IBM for the year of 1998? How can I 
retrieve that vector from the following list?

What if I wanna a matrix with data of IBM for the year from 1998 to 2004?

> data
$CSHO
          IBM  MSFT   DELL    GOOG     CBS
1998  915.907  2470  322.0      NA 690.327
1999 1784.216  5109 1271.5      NA 751.214
2000 1742.900  5283 2575.0      NA      NA
2001 1723.194  5383 2601.0      NA      NA
2002 1722.367  5359 2602.0 145.346      NA
2003 1694.509 10771 2579.0 160.866      NA
2004 1645.592 10862 2556.0 266.917      NA

$AT
        IBM  MSFT  DELL     GOOG   CBS
1998  86100 22357  4268       NA 20139
1999  87495 37156  6877       NA 33125
2000  88349 52150 11471       NA    NA
2001  88313 59257 13435       NA    NA
2002  96484 67646 13535  286.892    NA
2003 104457 79571 15470  871.458    NA
2004 109183 92389 19311 3313.351    NA

The above example actually is a 2x5x7 data.
The key point is I'm trying to find a data structure which can give me the 
flexibility to retrieve any data using the names of the dimensions.
Any thoughts will be greally appreciated.


> Brian X. Wu
> ___________________________
> 
> This message is intended only for the personal and confidential use of the 
> designated recipient or recipients named above.  If you are not the intended 
> recipient of this message you are hereby notified that any review, 
> dissemination, distribution or copying of this message is strictly 
> prohibited.  This communication is for information purposes only and should 
> not be regarded as an offer to sell or as a solicitation of an offer to buy 
> any financial product, an official confirmation of any transaction, or as an 
> official statement of Guzman & Company.  Email transmission cannot be 
> guaranteed to be secure or error-free.  Therefore, we do not represent that 
> this information is complete or accurate and it should not be relied upon as 
> such.  All information is subject to change without notice.
> 
> 
> 
> 
> 

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