[R-pkg-devel] CRAN pre-test failed on NOTE "no visible binding for global variable"

Iñaki Ucar |uc@r @end|ng |rom |edor@project@org
Tue Jul 2 16:19:13 CEST 2019


raúl

On Tue, 2 Jul 2019 at 14:18, Berlanga, Antonio J
<a.berlanga using imperial.ac.uk> wrote:
>
> Hi r-package-devel,
>
> I've submitted my first package but it failed the CRAN pre-tests on
> NOTES. I got:
>
> - my email
>
> - an extra non-standard file (which I have now added to .Rbuildignore)
>
> - NOTEs on "no visible global function definition"
>
> The first two I assume are harmless. The third I do not know how to fix
> (possible solutions below). Can it be ignored and suggest the fail was a
> false-positive?
>
> The third NOTE is:
>
> #######
>
> Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-ix86+x86_64
> Check: R code for possible problems, Result: NOTE
>   epi_clean_count_classes: no visible global function definition for
>     '%>%'
>   epi_clean_count_classes: no visible binding for global variable '.'
>   epi_plot_heatmap: no visible binding for global variable 'Var1'
>   epi_plot_heatmap: no visible binding for global variable 'Var2'
>   epi_plot_heatmap: no visible binding for global variable 'value'
>   epi_plot_heatmap_triangle: no visible binding for global variable
>     'Var1'
>   epi_plot_heatmap_triangle: no visible binding for global variable
>     'Var2'
>   epi_plot_heatmap_triangle: no visible binding for global variable
>     'value'
>   epi_plot_heatmap_triangle: no visible global function definition for
>     'element_text'
>   epi_plot_heatmap_triangle: no visible global function definition for
>     'coord_fixed'
>   epi_plot_heatmap_triangle: no visible global function definition for
>     'element_blank'
>   epi_plot_heatmap_triangle: no visible global function definition for
>     'element_rect'
>   epi_plot_heatmap_triangle: no visible global function definition for
>     'guide_colorbar'
>   epi_stats_summary: no visible global function definition for '%>%'
>   epi_stats_tidy: no visible global function definition for '%>%'
>   epi_stats_tidy: no visible binding for global variable '.'
>   epi_stats_tidy: no visible binding for global variable 'x'
>   epi_stats_tidy: no visible binding for global variable 'n'
>   epi_stats_tidy: no visible binding for global variable 'id'
>   Undefined global functions or variables:
>     %>% . Var1 Var2 coord_fixed element_blank element_rect element_text
>     guide_colorbar id n value x
> #######
>
>
> Solutions seem to cause errors elsewhere and there does not appear to be
> an ideal one unfortunately. It seems to me that adding a file in the
> directory 'R' containing eg:
>
> #######
>
> if(getRversion() >= "2.15.1") utils::globalVariables(c("."))
>
> #######
>
> is one of the preferred ways. This seems far from ideal though.

If you use NSE in your package, this is the best solution. You may
also switch to SE.

Iñaki



More information about the R-package-devel mailing list