Message-ID: <m2acigw9vj.fsf@fhcrc.org>
Date: 2005-09-14T04:28:48Z
From: Seth Falcon
Subject: is library loaded
In-Reply-To: <20050913215647.KHFI21470.tomts22-srv.bellnexxia.net@JohnDesktop8300> (John Fox's message of "Tue, 13 Sep 2005 17:56:48 -0400")
On 13 Sep 2005, jfox at mcmaster.ca wrote:
> packageLoaded() may well be a bad name but loadedNamespaces() won't
> detect a package without a namespace.
Right, that's a problem.
> It therefore seemed safe to me to check the path, which would
> include both packages with and without namespaces. With respect to
> loading and attaching, I thought that library() both loaded a
> package (with or without a namespace) and attached it to the search
> path, but I must admit that I'm easily confused about these
> distinctions.
As I understand it, library(foo) will load and attach package "foo".
If foo has a namespace, some of foo's dependencies may get loaded but
not attached. This is only possible if said dependencies also use
namespaces.
So it is possible for a package to be loaded and not attached. In
this case, the loaded package is not visible via search(), but is
visible via loadedNamespaces() since only packages with namespaces can
be loaded and not attached.
Clear as mud?
HTH,
+ seth