R-alpha: x[NA]

Thomas Lumley thomas@biostat.washington.edu
Mon, 22 Sep 1997 15:08:54 -0700 (PDT)


On 23 Sep 1997, Peter Dalgaard BSA wrote:

> 
> > BTW, while you obviously can't mix logical and numerical references I
> > think it's unfortunate that you can't mix numeric and name-based
> > references like
> > R> names(x)<-letters[1:4]
> > R> x
> > a b c d 
> > 1 2 3 4 
> > R> x[c("a",2)]
> > Error: subscript out of bounds
<snip> 
> 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?


	-thomas


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-