Skip to content
Prev 205734 / 398506 Next

table() and setting useNA to be there by default?

On 01/07/2010 11:02 PM, Sean O'Riordain wrote:
Hi Sean,
I have managed to get rid of the ugly "t" with this:

tableNA<-function(x) {
  varname<-deparse(substitute(x))
  assign(varname,x)
  tabNA<-table(get(varname),useNA="always")
  names(attr(tabNA,"dimnames"))<-varname
  return(tabNA)
}

Seems a long way round the paddock.

Jim