table(..., exclude=c(NA,NaN))
The dimnames attribute of the array contains the levels attribute of each of the arguments.
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