From i.aoultchenko at erasmusmc.nl  Tue Dec  8 18:04:34 2009
From: i.aoultchenko at erasmusmc.nl (Yurii Aulchenko)
Date: Tue, 8 Dec 2009 18:04:34 +0100
Subject: [Rd] extraction of sub-matrix by name
Message-ID: <7B217AE0-D867-472D-B985-1FD9212E5238@erasmusmc.nl>

Dear all,

sorry to bother you with potentially known issue --

we have noticed that if we select data frame rows by rownames, we get  
some results back if the match can be done unambiguously, though the  
match is not perfect (see example), e.g. x{"2",] will return a row if  
there is a unique row with name starting with "2" (but may be  
"2375745"!)

is that a planned behavior of R which will be maintained? for us it  
was a bit unexpected...

Yurii

-----------------------------
 > a <- data.frame(x=1:3, y=1:3)
 > rownames(a) <- c("2535","59617","555")
 > a
       x y
2535  1 1
59617 2 2
555   3 3
 > a["5",]
     x  y
NA NA NA
 > a["555",]
     x y
555 3 3
 > a["2",]
      x y
2535 1 1
 > version
                _
platform       i386-apple-darwin9.8.0
arch           i386
os             darwin9.8.0
system         i386, darwin9.8.0
status         Under development (unstable)
major          2
minor          11.0
year           2009
month          12
day            07
svn rev        50688
language       R
version.string R version 2.11.0 Under development (unstable)  
(2009-12-07 r50688)

-----------------------------------------------------------
Yurii Aulchenko
Erasmus MC Rotterdam
Department of Epidemiology, Ee 2200
Postbus 2040, 3000 CA Rotterdam
The Netherlands

phone: +31107043486
fax: +31107044657



[Rd] extraction of sub-matrix by name
Yurii Aulchenko