[Bioc-devel] no visible binding for global variable message
Laurent Gautier
lgautier at gmail.com
Fri Apr 4 15:23:44 CEST 2008
2008/4/3, Seth Falcon <seth at userprimary.net>:
> * On 2008-04-04 at 00:04 +1100 Keith Satterley wrote:
[...]
> > 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.
>
Wow.
I missed that one "new" feature with environments:
methods "[[" and "[[<-".
Looking quickly at the current development bioconductor code,
it seems that "assign" is still very much used.
L.
More information about the Bioc-devel
mailing list