table(..., exclude=c(NA,NaN))
NA
s) are allowed.
Arguments that are given in the
name=value
form will have a name in the
dimnames list.
exclude
argument to
category
when creating categories out of objects that are not already categories.
table
. For example, if
z <- table(arg1, arg2, arg3)
then
z[i,j,k]
is the number of times that the combination of the
i
-th level of the first category, the
j
-th level of the second,
and the
k
-th level of the third appeared together in the data.
A combination is not counted if missing values are present in the corresponding
element of any of the arguments.
dimnames
attribute of the array contains the
levels
attribute of each of the arguments.
Returns a multi-way array containing the number of observations in the
cells defined by the arguments to
table
.
Pet <- factor(c("Cat","Dog","Cat","Dog","Cat","?"), exclude="?") Food <- factor(c("Dry","Dry","Dry","Wet","Wet","Wet")) table(Pet, Food) # produces the following output: Dry Wet Cat 2 1 Dog 1 1 table(na.include(Pet), Food) Dry Wet Cat 2 1 Dog 1 1 NA 0 1