From murdoch.duncan at gmail.com  Fri Nov 25 02:09:08 2011
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Thu, 24 Nov 2011 20:09:08 -0500
Subject: [Rd] How to deal with package conflicts
In-Reply-To: <4ECEBAA5.3030403@yorku.ca>
References: <4ECEBAA5.3030403@yorku.ca>
Message-ID: <4ECEEAB4.2020201@gmail.com>

On 11-11-24 4:44 PM, Michael Friendly wrote:
> 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?

Not really.  I'd say the renaming is the preferred way to go, but you 
might also be able to convince Terry Therneau (survival author) to make 
ridge() a generic, so your method is called for your objects, and his is 
called for others.

Duncan Murdoch



[Rd] How to deal with package conflicts
Duncan Murdoch