From: Prof Brian Ripley <[EMAIL PROTECTED]>
Date: June 17, 2004 12:15:01 PM CEST
To: Meinhard Ploner <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
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,                  [EMAIL PROTECTED]
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


______________________________________________ [EMAIL PROTECTED] 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

Reply via email to