When writing functions for the R package, should non-standard evaluation be avoided?

When testing the package code with R CMD, check the following value for each variable used inside the dplyr functions using a non-standard estimate: " no visible binding for global variable ..." For example, if I used

 cars %>% mutate(speedplusone = speed +1) 

R CMD check will provide NOTE:

 no visible binding for global variable speed 

The question of deleting these notes has already been asked, and there is an answer from Hadley that makes it possible to either rewrite calls using a standard estimate or fake the existence of these variables with a call to globalVariables() .

According to Hadley's answers, I can delete these R CMD Check entries using a standard evaluation, replacing mutate with mutate_ :

 cars %>% mutate_(speedplusone = ~speed +1) 

Do I have to rewrite all dplyr function calls in the package to completely eliminate the standard evaluation?

+3
source share

Source: https://habr.com/ru/post/1273275/


All Articles