[Rd] Problem with table

Terry Therneau therneau at mayo.edu
Mon Mar 19 18:01:38 CET 2012


R version 2.14.0, started with --vanilla

 > table(c(1,2,3,4,NA), exclude=2, useNA='ifany')
    1    3    4 <NA>
    1    1    1    2

This came from a local user who wanted to remove one particular response 
from some tables, but also wants to have NA always reported for data 
checking purposes.
   I don't think the above is what anyone would want.

PS.
This is on a background of our local desires, which is to have the 
default action of the table command be
to report NA, if present.  (It's one of the only commands that we 
globally override at Mayo.)  The user had
added only the exclude=2 argument, and the useNA value is our default.

The above makes this harder to do without rewriting the command 
wholesale, which is ok (we've done it before at
various times in R and Splus) but we would avoid it if possible.  Please 
no wars about whether this is the "right" decison or not, we've done it 
for 10+ years and quite firmly believe the extra robustness gained by 
having NA appear
is worth the maintainance bother, correctness being paramount in medical 
research.  We're not trying to convert anyone
else, just get feedback on the best way to approach this.

Terry T.



More information about the R-devel mailing list