list of masked functions in R

2019-02-03 11:18发布

问题:

I use a lot of packages and I know some functions are masked because they exist in several different packages. Is there a way to get the list of duplicate functions (or masked functions?)

The ideal would be to have a list of duplicate function and for each of them, the list of packages in which it exists.

回答1:

in R base:

 conflicts(detail=TRUE)

And to find the list of environments that contain a version of

getAnywhere(x = "functionA")

Note: getAnywhere also finds the functions which are not exported. and that are hence not creating conflicts.

A better (simpler) result could be obtained using:

x = "functionA"
names(which(sapply(search(), FUN = function(env) exists(x, env, inherits = FALSE, mode = "function"))))