Re: [R] zero-fill absent data

2010-01-05 Thread Gabor Grothendieck
The zoo package's merge.zoo routines has a fill=0 argument so: create an expanded index, ix, and then in the next line create zoo objects from the data and the expanded index and merge them together. Finally in the last line convert back to a data frame. library(zoo) ix <- with(frame, seq(min(V1

Re: [R] zero-fill absent data

2010-01-05 Thread Peter Alspach
9 0.0 10 10 0.0 HTH ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dan Kortschak > Sent: Wednesday, 6 January 2010 11:40 a.m. > To: r-help@r-pro

[R] zero-fill absent data

2010-01-05 Thread Dan Kortschak
Hello, I have a set of data frames, generated by an SQL query that I am working with. Because of the way the query was written, zero values for the dependent variable (V2 in the example) are not recorded. Up until now this has not been a problem. I would like to be able to fill all absent data wi