In many cases being aware of missing data is crucial and ignoring them can seriously impair your analysis.
Therefore I'd like to set the useNA = "ifany"
as default for table()
. Ideally similar to options(stringsAsFactors = FALSE)
I found an ugly hack below, but it must go better and without defining a function.
https://stat.ethz.ch/pipermail/r-help/2010-January/223871.html
tableNA<-function(x) {
varname<-deparse(substitute(x))
assign(varname,x)
tabNA<-table(get(varname),useNA="always")
names(attr(tabNA,"dimnames"))<-varname
return(tabNA)
}