Dealing with the one problem at a time, I thought I would address the
no visible binding for global variable
'affylmGUIenvironment'
message which occurred in many functions, one for example was the
"ViewRNATargets" function.
"affylmGUIenvironment" is set in the affylmGUI function with the line:
assign("affylmGUIenvironment",new.env(),.GlobalEnv)
There's probably a cleaner way to code this now. I would consider
creating the environment within your package instead of the global
envirnt. And mostly for readability, I would not use assignsign() and
get() when working with environments, but instead [[ and <-. So you
could have:
affylmGUIenvironment <- new.env(hash=TRUE, parent=emptyenv())
Read the help page for details, but generally if you are using an
environment as a hashtable you don't what it to inherit bindings and
parent=emptyenv() is what you want.
Many variables are assigned to this environment with statements like:
assign("Targets", data.frame(),affylmGUIenvironment)
assign("adjustMethod","BH", affylmGUIenvironment)
assign("weightsPLM", data.frame(),affylmGUIenvironment)
These could all be written like:
affylmGUIenvironment[["Targets"]] <- data.frame()
I (or the original programmer) then used it in the ViewRNATargets
function with
some code like:
Targets <- get("Targets",envir=affylmGUIenvironment)
And this can be written as:
Targets <- affylmGUIenvironment[["Targets"]]
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'
argument.
I think if the affylmGUIenvironment is defined at package scope, as
suggested above, you can define functions that refer to it without
incurring a warning from codetools (untested).
Question 1. Should I try an eliminate these "no visible binding for
global
variable" warning messages from codetools?