Re: [R] Surprise when indexing with a factor.

About this list Date view Thread view Subject view Author view Attachment view

From: Peter Dalgaard (p.dalgaard@biostat.ku.dk)
Date: Sun 09 May 2004 - 00:31:39 EST


Message-id: <x2llk3dm7o.fsf@biostat.ku.dk>

pallier <pallier@lscp.ehess.fr> writes:

> Given a named vector 'm' and a factor 'f' whose levels match (e.g.
> when 'm' is the result of a 'tapply' command using the factor f as
> INDEX), my intuition is that m[f] means m[as.character(f)]

It's not like we haven't visited this before. As I recall it, the main
argument for the actual behaviour is that otherwise you can *only*
index named vectors with levels a superset of those of the factor.
It makes little sense to have such a restriction, and even less to
have m[f] change if names are added to m.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:08 EST