Skip to content

table function in a matrix

3 messages · Rui Barradas, Sarah Auburn

#
Hello,

See the difference.


a <- b <- c("A", "A", "B", "B", "C", "A", "C", "D", "A", "D", "C", "A", 
"D", "C", "A", "C")
a[3] <- NA

table(a)
table(a, exclude=NULL) # always include NA
table(b, exclude=NULL) # always include NA

# more flexible
table(b, useNA="always")
table(b, useNA="ifany")

Hope this helps,

Rui Barradas

Em 02-07-2012 07:27, Sarah Auburn escreveu: