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

ws webb.sprague at gmail.com
Wed Sep 23 23:11:14 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

now this doesn't even work !!!!

> table(wtf, exclude=NULL)
wtf
   [0,10)   [10,20)   [20,30)   [30,40)   [40,50)   [50,60)   [60,70)   [70,80)
     8562     15297      9666      6659      3583       667      1357       238
  [80,90)  [90,100) [100,110) [110,120) [120,130) [130,140) [140,150) [150,160)
       61       311        57        19        95         7         3       111
[180,190)      <NA>
      161     62161

Compare: 
> xtabs (~ wtf, exclude=NULL, na.action=na.pass)
wtf
   [0,10)   [10,20)   [20,30)   [30,40)   [40,50)   [50,60)   [60,70)   [70,80)
     8562     15297      9666      6659      3583       667      1357       238
  [80,90)  [90,100) [100,110) [110,120) [120,130) [130,140) [140,150) [150,160)
       61       311        57        19        95         7         3       111
[180,190)
      161

> 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