[Rd] "Name partially matched in data frame"

Hervé Pagès hpages at fhcrc.org
Thu May 1 00:34:24 CEST 2014


Would be good to have the man page updated about this. It still

  'x$name' is equivalent to 'x[["name", exact=FALSE]]'

which doesn't seem to be completely true anymore (the former emits
a warning in case of partial matching, not the latter).

It looks like for a data.frame, ‘x$name’ is now equivalent to
'x[["name", exact=NA]]':

   > data.frame(aa=1:3)$a
   [1] 1 2 3
   Warning message:
   In `$.data.frame`(data.frame(aa = 1:3), a) :
     Name partially matched in data frame

   > data.frame(aa=1:3)[["a", exact=NA]]
   [1] 1 2 3
   Warning message:
   In .subset2(x, i, exact = exact) : partial match of 'a' to 'aa'

except that, instead of just calling 'x[["name", exact=NA]]' internally,
the former comes up with its own (and less informative) error message.


 > sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-unknown-linux-gnu (64-bit)

  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

On 04/30/2014 12:32 PM, Duncan Murdoch wrote:
> On 30/04/2014 3:03 PM, Fisher Dennis wrote:
>> R 3.1.0
>> OS X
>> Colleagues,
>> I recently updated to 3.1.0 and I have encountered
>>     Warning messages: ...  Name partially matched in data frame
>> when I do something like:
>>     DATAFRAME$colname
>> where colname is actually something longer than that (but unambiguous).
>> I have much appreciated the partial matching capabilities because it
>> fits with my workflow.  I often receive updated data months after the
>> initial code is written.  In order to keep track of what I did in the
>> past, I provide lengthy (unambiguous) names for columns, then
>> abbreviate the names as I call them.  This behavior has been termed
>> “lazy” in various correspondence on this mailing list but it works for
>> me and probably works for others.
>> I realize that the new message is only a warning but it is a minor
>> nuisance.  Would it be possible to add an
>>     option(partialMatch=TRUE)    ## default is FALSE
>> or something similar to suppress that behavior?  That should keep both
>> camps happy.
> I'd be much happier with a general mechanism to suppress particular
> warnings.  Then you could choose to suppress this one.
> We might be able to do that with options("warning.expression"), but I
> don't see how...
> Duncan Murdohc
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the R-devel mailing list