[Rd] How to deal with package conflicts

Michael Friendly friendly at yorku.ca
Thu Nov 24 22:44:05 CET 2011

In my genridge package, I define a function ridge() for ridge 
regression, creating objects of class 'ridge'
that I intend to enhance.

In a documentation example, I want to use some functions from the car 
package. However, that package
requires survival, which also includes a ridge() function, for coxph 
models. So, once I require(car)
my ridge() function is masked, which means I have to use the awkward 
form below in my .Rd files.

ridgemod <- genridge::ridge(...)

I tried to detach survival, but that doesn't work:

 > detach("package:survival")
Error: package ‘survival’ is required by ‘car’ so will not be detached

I don't see any solution to this, other than
(a) renaming my ridge() to something else -- don't want to do this
(b) use \dontrun{} for the examples that use car

Or, is there some other way?

Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

More information about the R-devel mailing list