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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.