[Bioc-devel] using data() inside a package function
Martin Morgan
mtmorgan at fhcrc.org
Tue Aug 30 20:29:59 CEST 2011
On 08/30/2011 10:17 AM, Stephanie M. Gogarten wrote:
> I stored the results of a calculation in the data directory of my
> package, so it can be loaded when needed by a function.
>
> data/relationsMeanVar.RData
>
> I then refer to this in the function as
> data(relationsMeanVar)
> FS <- relationsMeanVar$FullSibs
Hi Stephanie --
a little speculative on my part but data() as invoked above loads the
data into the global environment, which would be a bad thing (e.g.
clobbering variables of the same name the user might have created, but
in generally having a side-effect). So maybe
env = new.env(parent=emptyenv())
data(relationsMeanVar, envir=env)
FS = env[["relationsMeanVar"]]$FullSibs
I'm not sure whether this calms R CMD check or not, but is probably
better regardless.
Martin
>
> This generates a NOTE in R CMD check:
> * checking R code for possible problems ... NOTE
> ibdPlot: no visible binding for global variable ‘relationsMeanVar’
>
> Is there a better way to do this?
>
> thanks,
> Stephanie Gogarten
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
--
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
Location: M1-B861
Telephone: 206 667-2793
More information about the Bioc-devel
mailing list