[Rd] NA as names of vector from subscripted matrix == bug ?
   
    Charles C. Berry
     
    cberry@tajo.ucsd.edu
       
    Mon, 8 Oct 2001 10:43:23 -0700 (PDT)
    
    
  
Is this a bug?
> matrix(1:4,nc=2,dimnames=list(1:2,1:2))[c(1,3)]
 1 NA 
 1  3 
It has some annoying consequences, e.g.
> median( matrix(1:9,nc=3,dimnames=list(1:3,1:3))[1,,drop=F] )
NA 
 4 
> 
The above was for 
Version:
 platform = sparc-sun-solaris2.7
 arch = sparc
 os = solaris2.7
 system = sparc, solaris2.7
 status = 
 major = 1
 minor = 3.0
 year = 2001
 month = 06
 day = 22
 language = R
The behavior seems to differ slightly in 1.3.1.
On Windows 1.3.1  
 matrix(1:9,nc=3,dimnames=list(1:3,1:3))[ cbind(1:3,1:3) ]
omits the names (as is my preference).
 
Charles C. Berry                        (858) 534-2098 
                                         Dept of Family/Preventive Medicine
E mailto:cberry@tajo.ucsd.edu	         UC San Diego
http://hacuna.ucsd.edu/members/ccb.html  La Jolla, San Diego 92093-0645
 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._