[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-devel
Subject:    [Rd] combining generics/methods from multiple packages
From:       Randall Pruim <rpruim () calvin ! edu>
Date:       2014-07-29 3:56:56
Message-ID: 8B06E38F-B5DC-461C-8252-EBE1A5C1DE91 () calvin ! edu
[Download RAW message or body]


I=92m wondering if there is any way for me to create a generic function in =
a package that merges the generics and methods from two or more packages th=
at each define a generic with the same name, but have non intersecting inst=
ances.

Here is an example.  dplyr and MASS both define an S3 generic select() but =
define no colliding methods.  Just to make life extra interesting, there is=
 also utils::select.list() which is not intended to be a method for select(=
) and in fact wants to receive a character vector, not a list.

I would like to create a generic select() in my package such that

1) select.ridgelm <- MASS:::select.ridgelm  [Note: this is not exported.]

2) select.data.frame <- dplyr::select.data.frame [Also not exported.] etc. =
for other methods in this package.

3) utils::select.list does NOT act like the select method for lists.

The only way I have been able to figure out how to do this requires use of =
the ::: operator, so let me add criterion 4:

4) The resulting package must pass CRAN checks without issues.

Is this possible?  If so how?

My goal is to have select() work on objects that either package can handle =
without having to use MASS::select() or dplyr::select().

Thanks in advance for any help =97 even if it is an explanation for why thi=
s is impossible and I should stop trying.

=97rjp

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic