Le-Huynh Truc-Ly
  • home
  • projects
  • r-code
  • blog
  • publications
  • CV
  • get in touch!
    • LinkedIn
    • email
    • GitHub

On this page

  • Note
  • Solution

Undefined global variables

tips
R
R-package
NOTE when creating new function in Rpackage

Note

I am creating a new function in my Rpackage. After running devtools::check(), I get this NOTE:

checking R code for possible problems ... NOTE
  function_name1: no visible binding for global variable 'value1'
  function_name2: no visible binding for global variable 'value2'
  Undefined global variables:
    value1 value2

Solution

Create a file globals.R in the R folder, listing undefined global variables:

utils::globalVariables(c("value1", "value2"))

© 2021-2026 Le-Huynh Truc-Ly

 

This website is built with GitHub, R, and Quarto