[R] packages & data-sets & name spaces

From: Meinhard Ploner <meinhardploner_at_gmx.net>
Date: Fri 09 Jul 2004 - 23:02:25 EST


> From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
> Date: June 17, 2004 12:15:01 PM CEST
> To: Meinhard Ploner <meinhardploner@gmx.net>
> Cc: r-help@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
>>
>> library(pkg-name)
>>
>> "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
> in
> the user workspace (.GlobalEnv), though. Suggestions:
>
> 1) See how MASS does it. Data objects are loaded into the MASS
> namespace
> 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 (MASS.load.data).
Now all works fine and I'm very happy about this solution!

Thanks a lot!
Meinhard Ploner

> 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
> it
> differently).
>
> --
> Brian D. Ripley, ripley@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
>



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jul 09 23:12:34 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:47 EST