[Bioc-devel] no visible binding for global variable message

Keith Satterley keith at wehi.EDU.AU
Thu Apr 3 15:04:19 CEST 2008

Help please,

I'm checking over my affylmGUI package under R-2.7.0dev.

If I do an R CMD check affylmGUI

with the environment variable _R_CHECK_USE_CODETOOLS_ set to true
There are no error messages and the package runs ok. However I get over 400 
lines of messages, the first few of which are:

* checking R code for possible problems ... NOTE
affylmGUI: no visible binding for global variable
affylmGUI: no visible binding for global variable '.affylmGUIglobals'
affylmGUI : <anonymous>: no visible binding for global variable

There were some messages I found useful, such as " unused argument(s)"
After some investigation, I released I could load the codetools package and get 
a function by function report using the checkUsage() function.

This gave me some more useful reports such as "no visible global function 
definition for ‘tkrplot’".

Dealing with the one problem at a time, I thought I would address the
no visible binding for global variable
message which occurred in many functions, one for example was the 
"ViewRNATargets" function.
"affylmGUIenvironment" is set in the affylmGUI function with the line:


Many variables are assigned to this environment with statements like:

assign("Targets",      data.frame(),affylmGUIenvironment)
assign("adjustMethod","BH",         affylmGUIenvironment)
assign("weightsPLM",   data.frame(),affylmGUIenvironment)

I (or the original programmer) then used it in the ViewRNATargets function with 
some code like:

Targets <- get("Targets",envir=affylmGUIenvironment)

The affylmGUIenvironment variable was not passed to the ViewRNATargets function 
- there were no arguments to this function.

By putting affylmGUIenvironment in as an argument to the ViewRNATargets 
function, checkUsage(ViewRNATargets) was happy and no longer reported a non 
visible binding for the global variable, However the function fails now with a 
message "Error in get("Targets", envir = affylmGUIenvironment):invalid 'envir' 

Question 1. Should I try an eliminate these "no visible binding for global 
variable" warning messages from codetools?

Question 2. If I should, how can I do it and still have working code!

Thanks for any suggestions, I'm still learning a lot of the finer points of R,


 > sessionInfo()
R version 2.7.0 Under development (unstable) (2008-03-23 r44847)


attached base packages:
[1] tools     tcltk     stats     graphics  grDevices datasets  utils 
methods   base

other attached packages:
[1] affylmGUI_1.13.1     affy_1.17.8          preprocessCore_1.1.5 affyio_1.7.14 
        Biobase_1.99.2       limma_2.13.6
[7] codetools_0.1-3

Keith Satterley
affylmGUI maintainer
Bioinformatics Division
The Walter and Eliza Hall Institute of Medical Research
Parkville, Melbourne,
Victoria, Australia

More information about the Bioc-devel mailing list