[R] provide() deprecated -- what's the substitute?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Fri Aug 11 13:35:35 CEST 2000


On Fri, 11 Aug 2000, Martin Maechler wrote:

> I know I should probably know the answer,
> but I've forgotten, and  ?provide only gives me the Deprecation page,
> not the *reason* for deprecation and the substitute to use..
> 
> >>>>> "BDR" == Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:
> 
>     BDR> On Thu, 10 Aug 2000, Kenneth Cabrera wrote:
>     >> Hello, R-users!
>     >> 
>     >> When I load the sgeostat library I obtain some warnings messages.
>     >> 
>     >> >library(sgeostat)
>     >> 
>     >> What kind of problem will I expect to have with these messages?
>     >> 
>     >> Loading required package: mva
>     >> Loading required package: tripack
>     >> Warning messages:
>     >> 1: `provide' is deprecated.
>     >> See ?Deprecated. in: .Deprecated()
>     >> 2: `provide' is deprecated.
>     >> See ?Deprecated. in: .Deprecated()
>     >> 
> 
>     BDR> Probably none. The purpose of provide() was to allow one package
>     BDR> to subsume or masquerade as another.  It seems only to have been
>     BDR> used incorrectly for a package to provide itself, which just
>     BDR> slowed down searches.
> 
> And what about the cases where it *was* used correctly?

(Were there any?  When this was discussed on R-core, no one came
up with any current ones.)

> If I have an experimental version of a package "foo" and name it "fooExp",
> and then do
>      library(fooExp)
> and
>      provide("foo")
> (or have this in  fooExp's  zzz.R)
> 
> I subsequently want that any code that has 
>    require(foo)
> does NOT load the non-experimental foo,
> but uses the experimental  fooExp.
> 
> How would I accomplish this easily, once  provide() [& .Provided ] are
> gone ?

The current idea is that you don't rename foo, but load it from a different
library (in the strict sense, a directory containing installed packages).
Contrast

library(foo)  # regular version
library(foo, lib.loc="/my/experimental/packages") # experimental version

Now the second works correctly, there is no need for masquerading.
In particular help is now found in the right places, and one can
now detach a library (detach("package:foo")) and re-load a different
version.

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list