[英]Could not find function "%>%" during CMD check
I wrote an R package, which is based on dplyr
.我写了一个基于
dplyr
的 R 包。 When I run the CMD check, an error pops up when evaluating the @examples.当我运行 CMD 检查时,在评估 @examples 时会弹出一个错误。
could not find function "%>%"
Calls: Rresult
Execution halted
I have added dplyr
in the description file, and the package works well when I run the examples myself.我在描述文件中添加了
dplyr
,当我自己运行示例时,该包运行良好。 I don't know where the problem is.我不知道问题出在哪里。
Here is part of my description file:这是我的描述文件的一部分:
Imports:
stats,
utils,
dplyr
As a matter of fact, during CMD check, some notes on no visible binding for global variable
also appeared, which are related to dplyr
package.事实上,在CMD检查的时候,也出现了一些关于
no visible binding for global variable
注释,这与dplyr
包有关。 For instance例如
Rresult: no visible global function definition for ‘group_by’
Undefined global functions or variables:
group_by
I used following code to remove the notes:我使用以下代码删除注释:
group_by <- filter_at <- "%>%" <- NULL
Thanks a lot for your help非常感谢你的帮助
Add this to the script that contains the function(unless you imported the entire dplyr).将此添加到包含该函数的脚本中(除非您导入了整个 dplyr)。
@importFrom magrittr "%>%"
If you intend to use dplyr
functions maybe explicitly call them like:如果您打算使用
dplyr
函数,可以像这样显式调用它们:
dplyr::group_by
dplyr::filter_at
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.