Hi all,

This occurred in R-2.11.0 (WinXP).

The R-help page of .[ says that:

"Character indices can in some circumstances be partially matched (see
pmatch) to the names or dimnames of the object being subsetted (but never
for subassignment). Unlike S (Becker et al p. 358)), R has never used
partial matching when extracting by [, and as from R 2.7.0 partial matching
is not by default used by [[ (see argument exact)."

My understanding is therefore that .[ should never try partial matching.

However:

> df = data.frame(a=c(1,2,3,9), b=c(4,5,6,10))
> rownames(df) = c("ef","gg","hh","fe")
> df
   a  b
ef 1  4
gg 2  5
hh 3  6
fe 9 10


> df["e",]
      a b
ef 1 4

> rownames(df) = c("ef","gg","hh","efg")
> df["e",]
    a  b
NA NA NA

So, it looks like partial matching is done using pmatch("e",rownames(df))
for "[". If this is true, the help page is not correct.

Thanks !
Regards,
Hilmar

---
Hilmar Berger
Integromics S.L. / CNB-CSIC
Madrid, Spain

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to