[R] setting up zoo objects from a data frame: solved.

Erin Hodgess erinm.hodgess at gmail.com
Tue Jun 8 17:04:53 CEST 2010


Here is a particular way to solve the problem:

> test3 <- seq(from=as.Date("1/1/2000","%m/%d/%Y"),to=as.Date("1/3/2000",
+ "%m/%d/%Y"),length=3)
> test3
[1] "2000-01-01" "2000-01-02" "2000-01-03"
> zoo(table(dog.df$V1,dog.df$V2)[,1],order=test3)
2000-01-01 2000-01-02 2000-01-03
         1          1          0
> cat.zoo <- zoo(table(dog.df$V1,dog.df$V2)[,1],order=test3)
> dog.zoo <- zoo(table(dog.df$V1,dog.df$V2)[,1],order=test3)
> dog.zoo <- zoo(table(dog.df$V1,dog.df$V2)[,2],order=test3)
> tree.zoo <- zoo(table(dog.df$V1,dog.df$V2)[,3],order=test3)
> dog.zoo
2000-01-01 2000-01-02 2000-01-03
         1          0          1
> tree.zoo
2000-01-01 2000-01-02 2000-01-03


thanks though!
sincerely,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com



More information about the R-help mailing list