On 22 April 2021 at 16:28, Kevin R. Coombes wrote:
| I'm trying to help clean up an R package for someone else to submit to 
| CRAN. He has used ggplot2 to implement a plotting function for the kinds 
| of things that his packages generates. His plotting routine basically 
| looks like (after changing names to protect the innocent):
| 
| myPlot <- fucntion(myData, ...) {
|     # get ready
|     ggplot(myData, aes(x = myX, y = myY)) +
|        # add my decorations
|        theme_bw()
| }
| 
| Of course, "R CMD check --as-cran" complains that there is no global 
| binding for "myX" or "myY" since they are columns defined in the 
| data.frame "myData".
| 
| What is the best way to work around this issue?

You can use the globalVariables() function to tell R about them:

   utils::globalVariables(c("myX", "myY"))

Dirk

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to