Message-ID: <4DD50575.8080404@gmail.com>
Date: 2011-05-19T11:56:37Z
From: Duncan Murdoch
Subject: identical function names from 2 packages
In-Reply-To: <4DD47A3C.3010400@berkeley.edu>
On 18/05/2011 10:02 PM, Nick Matzke wrote:
> Hi,
>
> If I load 2 packages that have a function with the same
> name, how do I tell R to run one or the other?
>
> (Instead of having R automatically use the first- or
> last-loaded one, whichever it is. (Which is it, by the way.))
>
> Cheers!
> Nick
>
>
It is the most recently attached one that would be chosen by default.
Generally that's also most recently loaded, but there can be exceptions.
Others have pointed out that :: is used to specify the package to use.
If you use that, you don't need to have the package attached: it will
be loaded but won't show up in the search path.
If you are using a package without a namespace, expect problems. Having
the namespace is nearly as good as automatically adding the pkg:: prefix
to every call from functions within the package. Not having the
namespace is nearly as bad as never using the prefix, even when you should.
Duncan Murdoch