xtabs2.Rd
Create a contingency table as an array, similar to xtabs
.
However, whereas xtabs
converts NA-s in 0, xtabs2
does not touch NA values.
Moreover, while output class in xtabs
is c("xtabs", "table"),
it is an array in xtabs2
.
xtabs2(formula = ~., data = parent.frame(), subset, sparse = FALSE, na.action, exclude = c(NA, NaN), drop.unused.levels = FALSE)
formula | a formula object with the cross-classifying variables
(separated by |
---|---|
data | an optional matrix or data frame (or similar: see
|
subset | an optional vector specifying a subset of observations to be used. |
sparse | logical specifying if the result should be a
sparse matrix, i.e., inheriting from
|
na.action | a function which indicates what should happen when
the data contain |
exclude | a vector of values to be excluded when forming the set of levels of the classifying factors. |
drop.unused.levels | a logical indicating whether to drop unused
levels in the classifying factors. If this is |
An array.