[Rd] Re: Packages and Libraries (was: Re: lme4 "package" etc

A.J. Rossini blindglobe at gmail.com
Wed Feb 9 06:38:07 CET 2005


On Wed, 9 Feb 2005 00:02:53 +0100, Achim Zeileis
<Achim.Zeileis at wu-wien.ac.at> wrote:
> On Tue, 08 Feb 2005 22:19:46 -0000 (GMT) (Ted Harding) wrote:
> 
> > On 08-Feb-05 Kurt Hornik wrote:
> > > Afaic, one of the issues is that it seems common practice to refer
> > > to collections of code as "libraries" or "packages", and we're
> > > trying to use these rather general-purpose terms in a very precise
> > > meaning, and obviously not very successful, in particular because
> > > the use of"library" is highly non-standard.  One idea might be to
> > > replace the"library" by something else like ... "a place where R
> > > knows where to find packages" ... hmm, now that's too long, so ...
> >
> > The only issue I have with "library" vs "package" (or vice versa)
> > is the following.
> >
> > I *know* that a collection of functions etc. (such as nlme) is
> > properly called a "package". I could (and do) get ticked off if
> > I refer to it as a "library".
> >
> > However, if I want to use it then I enter
> >
> >   library(nlme)
> >
> > As a result, the little daemons who potter around re-wiring
> > my mental circuits sometimes cross-connect these two. As a
> > result, I can inadvertently refer to "the nlme library".
> >
> > An example is a recent mailing of mine to the list where
> > I twice referred to a certain "library" (and was amiably
> > rebuked by Martic Maechler) -- but then I saw that I had
> > also twice referred to the same "package" in the same mail!
> >
> > Personally I don't mind whether it is called "package" or
> > "library", though using the command library() to load a
> > package does tend, as described, to get me treading on my
> > own shoelaces.
> >
> > But, a propos, is there an R entity called a "library"
> > (other than the command) as distinct from a "package"?
> 
> A *library* is a directory in which you can find R *packages* (just as
> in real life you can find books in a library) and with
>   library("foo", lib.loc = "/path/to/bar")
> you want to get the package (book) "foo" from the library "bar" located
> at "/path/to/bar".
> 
> So the two are really distinct...in real life, you also wouldn't say
> that you have been in the book where they had a lot of libraries on the
> shelves, would you? ;-)
> 
> But as Kurt explained: this distinction between "library" and "package"
> is specific to R and does not correspond to common practice for other
> software systems.
> Z

Sure, but I'm not specifying which library I'd like to get the
packages from, thus it might be make perfect sense to say:

loadPackage("foo",library="bar")

But when I'm typing library, I'm loading a package, NOT specifying a
library to use.

Package is also confusing -- I keep thinking of it as a noun, as a
package specifier, while others like it as a verb; this was a useful
point for me that one person made.

But perhaps then adding the verb (well, I can see the point against,
but hear it out) might be useful.  Thus,

    package(action,location,name)

might be a useful function signature, though possibly not in that order.

-- 
best,
-tony

"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).

A.J. Rossini
blindglobe at gmail.com



More information about the R-devel mailing list