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

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to