R 在包中使用ggplot2时出现令人讨厌的ggplot2命名空间冲突
我正在为R包做贡献,我刚刚编写了一个函数,它创建了一组R 在包中使用ggplot2时出现令人讨厌的ggplot2命名空间冲突,r,ggplot2,namespaces,package,cran,R,Ggplot2,Namespaces,Package,Cran,我正在为R包做贡献,我刚刚编写了一个函数,它创建了一组ggplot2对象 该函数工作正常,但生成并R CMD Check警告我: replacing previous import by ‘ggplot2::%+%’ when loading ‘qmethod’ 我已经看过和@hadley's了,但没能找出问题所在 以下是我的命名空间的相关部分: import("ggplot2", "stringr") import("psych") importFrom("plyr","count")
ggplot2
对象
该函数工作正常,但生成并R CMD Check
警告我:
replacing previous import by ‘ggplot2::%+%’ when loading ‘qmethod’
我已经看过和@hadley's了,但没能找出问题所在
以下是我的命名空间的相关部分:
import("ggplot2",
"stringr")
import("psych")
importFrom("plyr","count")
importFrom("reshape2","melt")
importFrom("digest", "digest")
importFrom("RColorBrewer", "brewer.pal")
这是我的描述的一部分
:
Imports:
digest,
psych,
knitr,
RColorBrewer,
stringr,
ggplot2,
plyr,
reshape2
我在函数数组中调用ggplot2函数的部分,即R
如下所示(以及更多):
g结果是,import(“psych”)
是有问题的软件包
它似乎以某种方式再次导出ggplot::%+%
,尽管我想不出为什么会是这样
无论如何,解决办法是:
importFrom("psych", "principal") # that's the function we were using
我只是添加此链接作为警告来源的参考:
importFrom("psych", "principal") # that's the function we were using