Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using utils::globalVariables to avoid binding errors during R package checking

I am having trouble with getting rid of a series of "no visible binding" NOTES when I run the R package check for CRAN (on windows 7, Rstudio, R 2.15.3 and Rtools30).

I have already tried the following without succes: - using the recommended utils::globalVariables(c("sig","dat",...etc - NULLing the variables, e.g., sig = NULL; dat = NULL;

What ends up happening is that I get a "cannot change value of locked binding for sig" etc. The code works but it won't be accepted because of these binding errors.

The people at CRAN told me to use: utils::globalVariables(). Where should I place this function?

like image 221
user2177786 Avatar asked Mar 16 '13 20:03

user2177786


1 Answers

Add utils::globalVariables(c("obj1", "obj2")) on the very top of the .R file which used these non-binding global variables, such as obj1, obj2.

like image 199
Vivian Zhang Avatar answered Sep 24 '22 15:09

Vivian Zhang