[R] Muliple partial matches with pmatch

John Maindonald john.maindonald at anu.edu.au
Tue May 25 07:16:00 CEST 1999


I am using R0.64.1 under Windows 95.

The help for `pmatch' states that:

        If `duplicates.ok' is false multiple matches will result
        in the value of `nomatch' being returned, and if it is
        true, the index of the first matching value will be
        returned.

The help for pmatch gives the following examples:

        pmatch("m",   c("mean", "median", "mode")) # returns NA
        pmatch("med", c("mean", "median", "mode")) # returns 2

What I find is:

> pmatch("m",c("median","mean","mode"))
[1] 3

> pmatch("me",c("median","mean","mode"))
[1] NA

> pmatch("me",c("median","mean","mede"))
[1] 3

> pmatch("me",c("median","mean","mode"),duplicates.ok=T)
[1] 1

Is this a bug?

John Maindonald               email : john.maindonald at anu.edu.au        
Statistical Consulting Unit,  phone : (6249)3998        
c/o CMA, SMS,                 fax   : (6249)5549  
John Dedman Mathematical Sciences Building
Australian National University
Canberra ACT 0200
Australia

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list