Skip to content
Prev 178240 / 398506 Next

argument 'exclude' in function xtabs

I think I see what's happening, and it's a little confusing to me, too.  
If your classifying factor to xtabs is not
actually a factor, but say, a character vector, it will be converted to a
factor
while using the "exclude" argument.  However, if it already is a factor,
this does not happen.
So, for example, contrast:

trt.char <- c("A","B","C","A","B","C")
xtabs(~trt.char, exclude = "B")

with

trt.fac <- factor(c("A","B","C","A","B","C"))
xtabs(~trt.fac, exclude = "B")

Hope that helps,
Erik Iverson