[R-pkg-devel] Absent variables and tibble

Duncan Murdoch murdoch.duncan at gmail.com
Tue Jun 28 21:17:23 CEST 2016


On 28/06/2016 1:15 PM, Duncan Murdoch wrote:
> I've now added a simple implementation of hasName to R-devel and
> R-patched.  When I find the time, I'll go through the base packages and
> change the !is.null(x$name) idiom to hasName.  (All but "base", that
> is:  hasName is in utils, and it is better if base remains self-contained.)

After looking at a few cases, I don't think I'll do that.  Often the 
test is used to find out if x$name will work.  hasName(x, "name") is not 
sufficient for that:  x might have that as a name, but x$name won't 
work, e.g. in a named numeric vector.  I don't think we have a simple 
test corresponding to

!is.null(x$name) && hasName(x, "name")

Probably the best approach is to run tests with 
options(warnPartialMatchDollar = TRUE), and just use the simple 
!is.null(x$name).

Duncan Murdoch



More information about the R-package-devel mailing list