[R] packages & data-sets & name spaces
meinhardploner at gmx.net
Fri Jul 9 15:02:25 CEST 2004
> From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
> Date: June 17, 2004 12:15:01 PM CEST
> To: Meinhard Ploner <meinhardploner at gmx.net>
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] packages & data-sets
> On Thu, 17 Jun 2004, Meinhard Ploner wrote:
>> It's possible to create a package with functions and data,
>> from which the use
>> "attaches" not only the functions, but also the data?
>> I want avoid to use
>> data(dataset, package="name")
>> because this makes a global copy of the data-set ...
> What do you mean by `global'? You cannot have access to R data without
> having it in memory and having it visible. You don't need to have it
> the user workspace (.GlobalEnv), though. Suggestions:
> 1) See how MASS does it. Data objects are loaded into the MASS
> on first use.
After some playing-around I found that I forgot to insert in NAMESPACE
export(package.load.data) which I defined as you in MASS/R
Now all works fine and I'm very happy about this solution!
Thanks a lot!
> 2) See ?attach and attach an R save file containing your datasets --
> wasteful unless you use them all at once.
> It is planned that data() will be superseded by a better mechanism in R
> 2.0.0 (but that plan has slipped a bit already, which is why MASS does
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help