On Mon, Feb 9, 2015 at 8:52 AM, Kirill Müller <kirill.muel...@ivt.baug.ethz.ch> wrote: > Hi > > > I haven't found a way to produce a tabulation from factor data with NA > values using xtabs. Please find a minimal example below, it's also on R-pubs > [1]. Tested with R 3.1.2 and R-devel r67720. > > It doesn't seem to be documented explicitly that it's not supported. From > reading the code [2] it looks like the relevant call to table() doesn't set > the "useNA" parameter, which I think is necessary to make NAs show up in the > result. > > Am I missing anything? If this a bug -- would a patch be welcome? Do we need > compatibility with the current behavior? > > I'm aware of workarounds, I just prefer xtabs() over table() for its > interface. >
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 -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel