Re: [Rd] Defining a method in two packages

2010-03-10 Thread Douglas Bates
I think a simpler solution, which I have implemented in lme4 but not yet released is to have importFrom(nlme, ranef, fixef) in the NAMESPACE file of packages that implement methods for those generics (and, of course, add nlme to the Imports: specification in the DESCRIPTION file). As nlme is a

Re: [Rd] Defining a method in two packages

2010-03-10 Thread Terry Therneau
Doug wrote: I think a simpler solution, which I have implemented in lme4 but not yet released is to have importFrom(nlme, ranef, fixef) in the NAMESPACE file of packages that implement methods for those generics (and, of course, add nlme to the Imports: specification in the DESCRIPTION

Re: [Rd] Defining a method in two packages

2010-03-09 Thread Uwe Ligges
On 08.03.2010 17:16, Terry Therneau wrote: Brian Uwe, Thanks for responding. Let me see if I can refine the query and move towards a solution. From Uwe: Of course, after loading lme4, you can still use the ranef from coxme: coxme::ranef(fit) Of course, but I'm interested in other

Re: [Rd] Defining a method in two packages

2010-03-09 Thread Kevin Coombes
Wouldn't it make sense to simply create a ranef package whose only role in the universe is to create the generic function that lme4, coxme, and anyone else who needs it could just import, without getting tons of additional and (depending on the application) irrelevant code? Best, Kevin

Re: [Rd] Defining a method in two packages

2010-03-08 Thread Terry Therneau
Brian Uwe, Thanks for responding. Let me see if I can refine the query and move towards a solution. From Uwe: Of course, after loading lme4, you can still use the ranef from coxme: coxme::ranef(fit) Of course, but I'm interested in other users (as well as myself) and prefer to avoid the

Re: [Rd] Defining a method in two packages

2010-03-06 Thread Uwe Ligges
Terry, this happens since the ranef in coxme is a S3 generic and the one in lme4 is a S4 generic. Of course, after loading lme4, you can still use the ranef from coxme: coxme::ranef(fit) and get the desired result. If you write your own code, you might want to use that call explicitly

Re: [Rd] Defining a method in two packages

2010-03-06 Thread Prof Brian Ripley
On Sat, 6 Mar 2010, Uwe Ligges wrote: Terry, this happens since the ranef in coxme is a S3 generic and the one in lme4 is a S4 generic. But the packages could be more cooperative. There is also a S3 generic for ranef in package nlme. Ideally the S4 generic in lme4 would have a default

[Rd] Defining a method in two packages

2010-03-05 Thread Terry Therneau
The coxme package has a ranef() method, as does lme4. I'm having trouble getting them to play together, as shown below. (The particular model in the example isn't defensible, but uses a standard data set.) The problem is that most of the time only one of lme4 or coxme will be loaded, so each

Re: [Rd] Defining a method in two packages

2010-03-05 Thread Kevin Wright
Sorry for one more email, but here is a more concise and pertinent ranef example: # Allow S4 methods to find S3 asreml objects setOldClass(asreml) if(!isGeneric(ranef)){ setGeneric(ranef, function(object, ...) standardGeneric(ranef)) } ranef.asreml - function(obj){ effects -