1

I'm trying to upload my package to CRAN and using devtools::check(), but I'm not able to understand why the function is showing 1 note.

The code is available in my repository. The check function shows the following message:


Duration: 44.3s

> checking R code for possible problems ... NOTE
  Found an obsolete/platform-specific call in the following function:
    'consulta_pedidos'
  Found the platform-specific device:
    'X11'
  dev.new() is the preferred way to open a new device, in the unlikely
  event one is needed.

0 errors √ | 0 warnings √ | 1 note x

Does anyone know the reason of this? Thank you in advance!

Igor
  • 145
  • 8
  • Look in [Programming with dplyr](https://dplyr.tidyverse.org/articles/programming.html), specifically the section *Eliminating R CMD check NOTEs*; notably, you can use `.data$X13` to avoid that note. Alternatively, you can use `utils::globalVariables(c("X1","X2",...,"X13","palavras"))` somewhere in your source code (not within a function). – r2evans Jan 04 '22 at 22:34
  • Thank you! It worked partially, I still have some notes: `> checking R code for possible problems ... NOTE Found an obsolete/platform-specific call in the following function: 'consulta_pedidos' Found the platform-specific device: 'X11' dev.new() is the preferred way to open a new device, in the unlikely event one is needed. 0 errors √ | 0 warnings √ | 1 note x` Maybe the check is understanding this X11 is a R function, but it's only a column name. Any ideas? – Igor Jan 04 '22 at 23:14
  • If you already tried `.data$X11` or `utils::globalVariables("X11")`, then I have no more ideas, sorry. If you're submitting to CRAN, you may need to include some notes about that one. – r2evans Jan 04 '22 at 23:39
  • Thank you for all the help! – Igor Jan 04 '22 at 23:43
  • Although it's not usually recommended, it may be worth editing your example here to include the output *after* you use `utils::globalVariables()` (to narrow the problem down to the "X11" problem, which is unique to you, unlike the "no visible binding" warnings, which are very common) – Ben Bolker Jan 04 '22 at 23:56
  • @BenBolker Done it. – Igor Jan 05 '22 at 01:06

1 Answers1

0

I'm pretty sure this is a false positive, from this code:

I haven't analyzed this in detail, but I think what's happening is that:

  • you are using the symbol X11 in your code (as part of a non-standard evaluation/symbolic pipeline)
  • when the checking code in R looks up that symbol, it finds a function ("closure") with that name in package::grDevices
  • it checks for specific 'bad' closures: bad_dev <- c("quartz", "x11", "X11")
  • it concludes that you're using a platform-specific graphics call and complains.

This might be worth submitting as a bug report, or at least for discussion (either on r-devel@r-project.org or r-package-devel@r-project.org).

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453