R-alpha: x[NA]

Peter Dalgaard BSA p.dalgaard@kubism.ku.dk
23 Sep 1997 11:13:23 +0200


Thomas Lumley <thomas@biostat.washington.edu> writes:

> 
> On 23 Sep 1997, Peter Dalgaard BSA wrote:

> > I think that the possibility of setting names(x)<-4:1 will demonstrate
> > why that can't work... Besides, can you be sure that the dependent
> > variable is the first one in a model frame any more?
> > 
> Why?
> R> x<-1:4
> R> names(x)<-4:1
> R> x[1]
> 4 
> 1 
> R> x["1"]
> 1 
> 4 
> So why not x[c(1,"1")] giving 1,4?

Because 

> c(1,"1")
[1] "1" "1"

so we'd have to introduce mixed-type vectors first. However, I suppose
that one might make

> x[list(1,"1")]

work.

-- 
   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-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-