From ripley@stats.ox.ac.uk  Fri Jan 24 20:22:02 2003
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Fri Jan 24 20:22:02 2003
Subject: [Rd] table() with option "exclude=NULL" (PR#2491)
Message-ID: <200301241922.UAA16243@pubhealth.ku.dk>

It's a feature, as a few seconds' exploration would have confirmed.

> x <- table(c(2,NA,1,1,1,NaN),exclude=NULL)
> names(x)
[1] "1"   "2"   NA    "NaN"

so R *does* label them, and as (unlike NaNs) it does not know what they 
are, it *prints* them as blanks.  (I wanted to change that but there was
resistance.)

Remember S does not have missing values in character strings.

On Fri, 24 Jan 2003 jerome@hivnet.ubc.ca wrote:

> Full_Name: Jerome Asselin
> Version: 1.6.2
> OS: redhat linux 7.2
> Submission from: (NULL) (142.103.173.179)
> 
> 
> 
> Bug or feature? Hard to say...
> But it sure would be nice if table()
> would label the frequency of NA's as
> it does for NaN's.

It does, so isn't R nice to you!

> Regards,
> Jerome
> 
> > table(c(2,NA,1,1,1),exclude=NULL)
> 
> 1 2
> 3 1 1
> > table(c(2,NA,1,1,1,NaN),exclude=NULL)
> 
>   1   2  NaN
>   3   1   1   1
> 
> #For sake of comparison, Splus returns:
> > table(c(2,NA,1,1,1,NaN),exclude=NULL)
>  1 2 NA NaN
>  3 1  1   1
> 
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] table() with option "exclude=NULL" (PR#2491)
ripley@stats.ox.ac.uk