Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: R 中的屏蔽函数 R:屏蔽函数 函数命名冲突
如果我有两个包:A 和 B。假设funfunA 中有函数命名 funfun,B 中也有函数命名。当我加载 A 和 B 时,我如何使用第一个funfun?
funfun
require(A) require(B)
如果我想funfun在A中使用,我该怎么写?
您可以像这样明确地引用包和函数组合:
A::funfun B::funfun
在不寻常的情况下,您可能不得不引用未在命名空间中导出的函数,这种情况下您需要使用:
A:::funfun B:::funfun
(但这是不寻常的,因为非导出函数不构成包 API 的一部分,这些函数可能会在包的后续版本中更改而不会发出警告。)