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

2010-06-08 Thread Gabor Grothendieck
The first time I posted this it got held up for approval so I am trying it again. Hopefully this time it gets through right away. As with your prior post we can use read.zoo(..., split=...). Alternatives are reshape and reshape::cast. # read data into DF Lines <- "V1 V2 1 1/1/2000 dog 2 1/1

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

2010-06-08 Thread Stefan Grosse
Am 08.06.2010 17:04, schrieb Erin Hodgess: > Here is a particular way to solve the problem: > If you solve your own problem then please reply to your own message otherwise things get confused. How should one know what your problem was without knowing your first e-mail - if you reply your own e-

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

2010-06-08 Thread Stefan Grosse
Am 08.06.2010 16:52, schrieb Erin Hodgess: > > I would like to set up 3 time series; one for dog, one for cat, one > for tree, such that each runs from 1/1/2000 to 1/3/2000, with 0 if > there is no entry for the day. > > > Before using zoo or zooreg you should transform your data.frame as such

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

2010-06-08 Thread Erin Hodgess
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

[R] setting up zoo objects from a data frame

2010-06-08 Thread Erin Hodgess
Dear R People: I have the following data frame: > str(dog.df) 'data.frame': 7 obs. of 2 variables: $ V1: Factor w/ 3 levels "1/1/2000","1/2/2000",..: 1 1 1 2 2 3 3 $ V2: Factor w/ 3 levels "cat","dog","tree": 2 1 3 1 3 2 3 > dog.df V1 V2 1 1/1/2000 dog 2 1/1/2000 cat 3 1/1/2000 t