How to unmask a function in R, due to name collisions on searchpath

ahala picture ahala · Jul 13, 2010 · Viewed 10.1k times · Source

When I loaded package debug to debug a script with zoo objects, I got trouble: function index from zoo got masked by debug package. How can I unmask index? In general, how to deal with these name colliding problems? We just do not use debug package with `zoo'?

Answer

Lionel Henry picture Lionel Henry · May 8, 2013

You can unload the package which has masked functions and then reload it. It will regain precedence in the searchpath:

unloadNamespace("zoo")
library("zoo")

In the future, if you want to load a package while preventing it from masking other functions, you can specify its position in the search path with an arbitrary large number:

library("debug", pos = .Machine$integer.max)