From hpages at fhcrc.org  Thu May  1 00:43:58 2014
From: hpages at fhcrc.org (=?windows-1252?Q?Herv=E9_Pag=E8s?=)
Date: Wed, 30 Apr 2014 15:43:58 -0700
Subject: [Rd] "Name partially matched in data frame"
In-Reply-To: <53617A70.80308@fhcrc.org>
References: <3781BDEC-E7D2-482A-A7A7-63B61B021754@plessthan.com>	<53614FC0.30408@gmail.com>
	<53617A70.80308@fhcrc.org>
Message-ID: <53617CAE.2070005@fhcrc.org>

Also the real agenda behind this warning is not clear. Looks like
just a normal warning, providing some potentially useful/important
information to the user.

However, in the NEWS file, this entry is in the DEPRECATED AND DEFUNCT
section:

       \item Partial matching when using the \code{$} operator \emph{on
         data frames} now throws a warning and may become defunct in the
       future. If partial matching is intended, replace \code{foo$bar}
       by \code{foo[["bar", exact = FALSE]]}.

Even though it's not deprecated yet...

H.

On 04/30/2014 03:34 PM, Herv? Pag?s wrote:
> Hi,
>
> Would be good to have the man page updated about this. It still
> says:
>
>   '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.
>
> Cheers,
> H.
>
>  > sessionInfo()
> R version 3.1.0 (2014-04-10)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=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



[Rd] "Name partially matched in data frame"
=?windows-1252?Q?Herv=E9_Pag=E8s?=