[R] Correcting for missing data combinations

GL pflugg at shands.ufl.edu
Fri Dec 11 19:19:47 CET 2009


I can think of many brute-force ways to do this outside of R, but was
wondering if there was a simple/elegant solution within R instead.

I have a table that looks something like the following:

Factor1	Factor2		Value
A	11/11/2009	5
A	11/12/2009	4
B	11/11/2009 	7
B	11/13/2009	8

>From that I need to generate all permutations of Factor1 and Factor2 and
force a 0 for any combination that doesn’t exist in the actual data table.
By way of example, I’d like the output for above to end up as:

 Factor1	Factor2		Value
A	11/11/2009	5
A	11/12/2009	4
A	11/13/2009	0
B	11/11/2009 	7
B	11/12/2009	0
B	11/13/2009	8

Truly appreciate any thoughts.

-- 
View this message in context: http://n4.nabble.com/Correcting-for-missing-data-combinations-tp961301p961301.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list