[R] Problem with xtabs(), exclude=NULL, and counting NA's

ws webb.sprague at gmail.com
Wed Sep 23 23:34:41 CEST 2009


Webb Sprague <webb.sprague <at> gmail.com> writes:

> 
> >> xtabs(~wkhp, x, exclude=NULL, na.action=na.pass)
> > wkhp
> >  20   30   40   45   60 <NA>
> >   1    1   10    1    3    4

(Forgive me for the repost, but I just joined the R list, so maybe this will go 
through.)

Now the above doesn't work!  See :

> table(JWMNP.cut, exclude=NULL)
JWMNP.cut
   [0,10)   [10,20)   [20,30)   [30,40)   [40,50)   [50,60)   [60,70)   [70,80)
     8345     14708      9314      6317      3437       649      1287       232
  [80,90)  [90,100) [100,110) [110,120) [120,130) [130,140) [140,150) [150,160)
       58       296        57        19        89         6         3       108
[160,170) [170,180) [180,190) [190,200) [200,Inf]      <NA>
        0         0       154         0         0     60888

> xtabs(~JWMNP.cut, exclude=NULL, na.action=na.pass)
JWMNP.cut
   [0,10)   [10,20)   [20,30)   [30,40)   [40,50)   [50,60)   [60,70)   [70,80)
     8345     14708      9314      6317      3437       649      1287       232
  [80,90)  [90,100) [100,110) [110,120) [120,130) [130,140) [140,150) [150,160)
       58       296        57        19        89         6         3       108
[160,170) [170,180) [180,190) [190,200) [200,Inf]
        0         0       154         0         0

> version
               _
platform       x86_64-unknown-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          9.2
year           2009
month          08
day            24
svn rev        49384
language       R
version.string R version 2.9.2 (2009-08-24)




More information about the R-help mailing list