Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find function "%>%" during CMD check

Tags:

package

r

dplyr

I wrote an R package, which is based on dplyr. When I run the CMD check, an error pops up when evaluating the @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. 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. 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

like image 640
Wang Avatar asked Oct 16 '22 07:10

Wang


1 Answers

Add this to the script that contains the function(unless you imported the entire dplyr).

@importFrom magrittr "%>%"

If you intend to use dplyr functions maybe explicitly call them like:

dplyr::group_by
dplyr::filter_at
like image 183
NelsonGon Avatar answered Oct 21 '22 01:10

NelsonGon