Skip to content
Prev 3230 / 63424 Next

Row subsetting of data frames (PR#425)

The problem boils down to
[1] 1

and the code expects 2, which is what S gives.  The description of

duplicates.ok: should duplicate matches be allowed?

     If there are multiple matches the result depends on the value of
     `duplicates.ok'. If this 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.

is different from S: the argument in S refers to allowing
duplicates in x, so
[1] 2 2 2
[1]  2  1 NA

A quick fix is in [.data.frame, to give

        if (is.character(i))
            i <- sapply(i, function(x) match(x, rows))

but I think we should make pmatch S-compatible.

Brian