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
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-
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
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
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
5 matches
Mail list logo