Re: [R] more dates and data frames

2010-06-08 Thread Bill.Venables
Here is one way ... DF4 <- cast(formula=Date~V2,data=DF3,value="X1",fill=0) d <- with(DF4, seq(min(Date), max(Date), by = 1)) ### full set m <- as.Date(setdiff(d, DF4$Date)) ### missing dates if(length(m) > 0) { extras <- cbind(data.frame(Date = m), cat = 0, dog = 0, tre

Re: [R] more dates and data frames

2010-06-08 Thread Gabor Grothendieck
Once again my message got held up for moderator approval so I am deleting it and trying again. Hopefully this one goes through. In general, we will get the simplest usage if we match the problem to the appropriate OO class. In this case we are using time series so it is advantageous to use a time

Re: [R] more dates and data frames

2010-06-08 Thread Henrique Dallazuanna
Try this: xtabs( ~ V1 + V2, transform(dog3.df, V1 = factor(V1, levels = as.character(seq(min(dog3.df$V1), max(dog3.df$V1), by = "days") On Tue, Jun 8, 2010 at 4:52 PM, Erin Hodgess wrote: > Dear R People: > > So thanks to your help, I have the following: > > > > dog3.df <- > read.delim("c:/