Skip to content
Prev 205603 / 398506 Next

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

Good morning,

Is there a way to get table() to default to including NAs  - as in...
table(..., useNA='ifany') or  table(..., useNA='always') or table(...,
exclude=NULL)  ?

I can't see a way under table() or options() or searching the archives
(probably using the wrong keyword?).
t1
1 2 3
1 2 3

I keep forgetting to allow for NAs and I was bitten *again* this
morning... ideally I'd like to be able to set a default in my profile
so that table(t1) will actually do table(t1, exclude=NULL) or
table(t1, useNA='ifany')

I could say something like..
t
   1    2    3 <NA>
   1    2    3    4

but this names it as 't' instead of 't1' which is ugly?

Any other suggestions please?

Thanks in advance,
Sean O'Riordain
Dublin
Ireland