R中的掩码函数列表 [英] list of masked functions in R

查看:159
本文介绍了R中的掩码函数列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了很多软件包,我知道一些功能被屏蔽,因为它们存在于几个不同的软件包中。
有没有办法获取重复的功能(或掩码函数)的列表?



理想的方法是将一个重复的功能列表和每个在其中存在的包的列表。

解决方案

在R base:

  conflict(detail = TRUE)

并找到包含

  getAnywhere(x =functionA)

注意: getAnywhere 还查找导出。因此不会产生冲突。



可以使用以下方式获得更好(更简单)的结果:

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


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.

解决方案

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"))))

这篇关于R中的掩码函数列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆