Skip to content
Prev 67269 / 398502 Next

NA in table with integer types

Hi -- I am having the following problem with table() when applied to
vectors of type (mode) integer.  When I use the table() command, I can
*only obtain an entry in the table for NA values by using exclude=NULL*.
Just issuing exclude=NaN will not do it.  See below, where x is double at
first, and then coerced to integer and notice the difference.  Is this a
bug or is there something that I do not understand about the integer data
type?  That is, is there some other value besides NA and NaN that "missing
integers" take? Thanks -- pr

------------------------------
[1] TRUE
x
1 2 3
1 1 2
x
   1    2    3 <NA>
   1    1    2    1
x
   1    2    3 <NA>
   1    1    2    1
[1]  1  2  3  3 NA
[1] FALSE FALSE FALSE FALSE  TRUE
[1] TRUE
x
1 2 3
1 1 2
x
1 2 3
1 1 2
x
   1    2    3 <NA>
   1    1    2    1
_
platform powerpc-apple-darwin6.8
arch     powerpc
os       darwin6.8
system   powerpc, darwin6.8
status
major    2
minor    0.1
year     2004
month    11
day      15
language R
------------------------------

==========================================================================
Paul Rathouz, Assoc. Professor       ph   773-834-1970
Dept. of Health Studies, Rm. W-264   fax  773-702-1979
University of Chicago                prathouz at health.bsd.uchicago.edu
5841 S. Maryland Ave. MC 2007
Chicago, IL  60637