1

For my current project I have the base and tidyverse packages loaded and about 14 more, and I occasionally worry about bugs from potential conflicts which I have missed.

I have just learned of the conflicts() function, which I think is intended to solve this problem. I find that I do not really understand some of its output. For example, with the option detail = TRUE:

$`package:maptools`
[1] "coerce" "coerce" "coerce" "coerce" "label"  "coerce" "coerce"

Does this mean that there are six environments containing alternative versions of coerce? If so, is this all of the conflicts, or only those where the conflicting name has higher precedence on the search path? Giving the name six times without adjacent information on where those conflicts occur seems unhelpful.

Also, some of the packages I have installed seem to have an implausibly large number of conflicts, and this makes me wonder if I am interpreting the output correctly: rlang with 57, sryyr with 81, BiocGenerics with 103.

Finally, I was hoping for a different organization, along the lines of alphabetic by function name, with each name followed by a list of environments in the order of the search path, so you can easily check for potential conflicts for a particular function (because the list is alphabetic) and immediately see which version of a function is active (because the environments are listed in search path order). I suppose I could write such a function from this list if I am interpreting it correctly, but I would rather not if a better one already exists.

andrewH
  • 2,281
  • 2
  • 22
  • 32
  • If you look at the source for `conflicts` and debug it, running through, you will notice that it is using `match(dups, z[[i]], 0L)` which is returning duplicate indices of matches, possibly because the `coerce` function is duplicated in multiple packages. I'd think that the `conflicts` should use `dups <- unique(dups)` before forming the details, at which point the output becomes more sensible. – r2evans May 01 '18 at 23:36
  • I don't know if there exists a function to summarize the namespaces and functions as you suggest; it might be somewhat informative, but I don't know what else it could be used for (for the masses) other than academic instruction on namespace collisions, etc. (I personally wouldn't mind a little more control over namespaces similar to python's `import`, but R has been around a while, and that sounds like a breaking change :-) – r2evans May 01 '18 at 23:39

0 Answers0