[Rd] name conflicts

Duncan Murdoch murdoch at stats.uwo.ca
Mon Aug 25 21:28:00 CEST 2008


On 8/25/2008 3:05 PM, Max Kuhn wrote:
> Everyone,
> 
> I've got code in my package that uses LogitBoost from the caTools
> package. caTools does not have a namespace.
> 
> My package also uses loads RWeka, which has a namespace, and also has
> a function called LogitBoost.
> 
> After loading both packages, how can I be specific about running the
> version from caTools (since caTools:::LogitBoost won't work)?

It's not easy.  Best would be to convince caTools to add a NAMESPACE.

But as a workaround:

library(caTools)
caToolsEnv <- as.environment("package:caTools")
LogitBoost <- caToolsEnv$LogitBoost

Note that there is no guarantee that LogitBoost will actually work. 
Because caTools doesn't have a NAMESPACE, there is a risk of other name 
clashes causing LogitBoost to behave unpredictably.

Duncan Murdoch



More information about the R-devel mailing list