[R] Weird problem with median on a factor

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 3 17:45:36 CET 2003


On Mon, 3 Nov 2003 RBaskin at ahrq.gov wrote:

> Continuing to beat the greasy spot in the road where the dead horse used to
> be....
> 
> 1) I know that the people building r are working on bigger and better things
> than this silly question and I appreciate the existence of this complicated
> package that was dropped in my lap for free.
> 
> 2) Tony Platt succinctly pointed out one of the underlying 'problems'
> (possibly in my understanding):
> 
> 
> > #this is a perfectly reasonable r object
> > some.weird.object<-factor(c("a","b","c"))
> > #this is an internal r function acting on an object
> > typeof(some.weird.object)
> [1] "integer"
> > #this is a primitive r function acting on an object
> > is.numeric(some.weird.object)
> [1] FALSE
> >
> 
> Do these functions behave in a design consistent manor??  Can a single r
> object simultaneously be of type integer and NOT numeric??  If this is
> intentional can someone explain why?

See the help for is.numeric: it *does* explain this.  You should be 
careful not to confuse classes with representations.

-- 
Brian D. Ripley,                  ripley at 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




More information about the R-help mailing list