Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Iñaki Ucar
On Sat, 10 Aug 2019 at 21:11, Lenth, Russell V wrote: > > Thanks Iñaki, > > However... > > > 1) renaming those methods (e.g., recover_data_foo, because as soon as > there is a something.foo > > in your namespace, it will be dispatched regardless of whether you > register it or not) > >

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Thanks, Luke. That's more efficient for sure. I'd just have to rename about a zillion existing internal methods -- but only once! Additional advantage I see is ability to control WHICH methods I'd allow to be overridden. Russ -Original Message- From: Tierney, Luke Sent: Saturday,

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Tierney, Luke
You could have your default method handle the cases you can handle; if you want that to dispatch you can use something like recover_data.default <- function(object, ...) default_recover_data(object, ...) default_recover_data <- function(object, ...) UseMethod("default_recover_data")

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Thanks, Duncan. That's helpful. In addition, I confess I had a closing parenthesis in the wrong place. Should be:. . . .GlobalEnv), silent = TRUE) Cheers, Russ -Original Message- From: Duncan Murdoch Sent: Saturday, August 10, 2019 2:43 PM To: Lenth, Russell V ; Iñaki Ucar

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Duncan Murdoch
On 10/08/2019 3:27 p.m., Lenth, Russell V wrote: H, I thought of an approach -- a kind of manual dispatch technique. My generic is recover_data <- function(object, ...) { rd <- try(getS3method("recover_data", class(object)[1], envir = .GlobalEnv, silent = TRUE)) if

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Thanks, Neonira. Always something new to learn! Russ From: neonira Arinoem Sent: Saturday, August 10, 2019 2:22 PM To: Lenth, Russell V Cc: Iñaki Ucar ; r-package-devel@r-project.org Subject: Re: [R-pkg-devel] [External] Re: Farming out methods to other packages What about turning your S3

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
H, I thought of an approach -- a kind of manual dispatch technique. My generic is recover_data <- function(object, ...) { rd <- try(getS3method("recover_data", class(object)[1], envir = .GlobalEnv, silent = TRUE)) if (!inherits(rd, "try-error")) rd(object, ...) else

Re: [R-pkg-devel] [External] Re: Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Thanks Iñaki, However... > 1) renaming those methods (e.g., recover_data_foo, because as soon as there is a something.foo > in your namespace, it will be dispatched regardless of whether you register it or not) If I do that, then emmeans won't support foo objects until foopkg offers

Re: [R-pkg-devel] Farming out methods to other packages

2019-08-10 Thread Iñaki Ucar
On Sat, 10 Aug 2019 at 19:21, Lenth, Russell V wrote: > > Dear developers, > > I maintain a package, emmeans, that provides post-hoc analyses for a variety > of models. These models are supported by writing S3 methods for recover_data > and emm_grid. Quite a few models are supported internally

[R-pkg-devel] Farming out methods to other packages

2019-08-10 Thread Lenth, Russell V
Dear developers, I maintain a package, emmeans, that provides post-hoc analyses for a variety of models. These models are supported by writing S3 methods for recover_data and emm_grid. Quite a few models are supported internally in emmeans, but it would really be better if the packages that