[R] Strange case of partial matching in .[ - possible bug / wrong documentation?
hilmar.berger at integromics.com
Wed May 19 22:41:18 CEST 2010
Duncan Murdoch schrieb:
> On 19/05/2010 12:14 PM, Hilmar Berger wrote:
>> 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
>> 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
>> is not by default used by [[ (see argument exact)."
>> My understanding is therefore that .[ should never try partial matching.
> See near the top of the page: "The descriptions here apply only to
> the default methods." Since indexing is generic, an extraction method
> can do whatever it wants, and you need to read the particular page to
> find the behaviour. The page for Extract.data.frame says:
> "Both |[| and |[[| extraction methods partially match row names. By
> default neither partially match column names, but |[[| will unless
> |exact=TRUE|. If you want to do exact matching on row names use |match
> <http://127.0.0.1:28754/library/base/help/match>| as in the examples."
> Duncan Murdoch
Sorry, I should have read the complete help page.
Thanks a lot !
More information about the R-help