xtabs and NA
On 09.02.2015 16:59, Gabor Grothendieck wrote:
On Mon, Feb 9, 2015 at 8:52 AM, Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> wrote: Passing table the output of model.frame would still allow the use of a formula interface:
mf <- model.frame( ~ data, na.action = na.pass)
do.call("table", c(mf, useNA = "ifany"))
a b c <NA>
1 1 1 1
Fair enough, this qualifies as a workaround, and IMO this is how xtabs should handle it internally to allow writing xtabs(~data, na.action = na.pass) -- or at least xtabs(~data, na.action = na.pass, exclude = NULL) if backward compatibility is desired. Would anyone with write access to R's SVN repo care enough about this situation to review a patch? Thanks. -Kirill