Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.SUN.3.95.970922150648.2314B-100000@troi>
Date: 1997-09-22T22:08:54Z
From: Thomas Lumley
Subject: R-alpha: x[NA]
In-Reply-To: <x2wwk9j9d0.fsf@bush.kubism.ku.dk>

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