loading data into ZOO

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

loading data into ZOO

Stephen J. Barr-2
Hello,

I have a simple question. I am trying to load data into a zoo object. I have
the data in CSV format as follows

SYMBOL DATE             TIME              PRICE
XX            YYYYMMDD HH:MM:SS      n.nn

and there are multiple symbols in this one data frame.

My question is, do I need to merge DATE and TIME before loading them or can
I specify multiple index.column or index.name fields?

Thanks,
-stephen

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: loading data into ZOO

braverock
Stephen J. Barr wrote:

> I have a simple question. I am trying to load data into a zoo object. I have
> the data in CSV format as follows
>
> SYMBOL DATE             TIME              PRICE
> XX            YYYYMMDD HH:MM:SS      n.nn
>
> and there are multiple symbols in this one data frame.
>
> My question is, do I need to merge DATE and TIME before loading them or can
> I specify multiple index.column or index.name fields?

index.column in read.zoo is a single column only

you can either merge in your CVS format, simplifying things in R, or use
read.table to get the data into R and then merge your index columns when you
call as.zoo.

Regards,

     - Brian

--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: loading data into ZOO

Gabor Grothendieck
In reply to this post by Stephen J. Barr-2
read.zoo does not allow multiple index fields but you can read it in
using read.table, combine the index fields and use read.zoo to read
the resulting data frame.  Note that read.zoo can read data frames,
not just files. Also note the aggregate= argument on read.zoo allows
direct handling of situations like this where there are multiple time
series each indicated by a field, in this case, SYMBOL.

On Wed, Dec 23, 2009 at 3:21 PM, Stephen J. Barr <[hidden email]> wrote:

> Hello,
>
> I have a simple question. I am trying to load data into a zoo object. I have
> the data in CSV format as follows
>
> SYMBOL DATE             TIME              PRICE
> XX            YYYYMMDD HH:MM:SS      n.nn
>
> and there are multiple symbols in this one data frame.
>
> My question is, do I need to merge DATE and TIME before loading them or can
> I specify multiple index.column or index.name fields?
>
> Thanks,
> -stephen

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.