Re: [Rd] Incompatible methods for overloaded operator

2012-06-25 Thread Winston Chang
This solution works - thanks for the feedback, everyone! On Thu, Jun 21, 2012 at 1:26 AM, Kohske Takahashi takahashi.koh...@gmail.com wrote: In my view the class a and b should inherit same parent, like class c. And S3methods should be defined for the class c. Actually, this is not a

Re: [Rd] Incompatible methods for overloaded operator

2012-06-21 Thread Kohske Takahashi
In my view the class a and b should inherit same parent, like class c. And S3methods should be defined for the class c. Actually, this is not a workaround. It will go with the more oop-ish design. kohske 2012/6/21 Winston Chang winstoncha...@gmail.com: On Wed, Jun 20, 2012 at 10:49 PM, Martin

Re: [Rd] Incompatible methods for overloaded operator

2012-06-21 Thread Renaud Gaujoux
Hi, I may be mistaken here but a possible interpretation of: If a method is found for just one argument or the same method is found for both, it is used. could be that the same method here does not mean identical in term of object/content (as identical tests), but means that the two

Re: [Rd] Incompatible methods for overloaded operator

2012-06-20 Thread Martin Morgan
On 06/20/2012 07:25 PM, Hadley Wickham wrote: Hi all, Any ideas about this? As far as I can tell it should work - and I don't understand why it's ok when run outside of a package. from ?groupGeneric under 'Ops' (of which + is one) used. If different methods are found, there is a

Re: [Rd] Incompatible methods for overloaded operator

2012-06-20 Thread Hadley Wickham
from ?groupGeneric under 'Ops' (of which + is one)          used.  If different methods are found, there is a warning          about 'incompatible methods': in that case or if no method is          found for either argument the internal method is used. which doesn't really explain why it

Re: [Rd] Incompatible methods for overloaded operator

2012-06-20 Thread Martin Morgan
On 06/20/2012 08:06 PM, Hadley Wickham wrote: from ?groupGeneric under 'Ops' (of which + is one) used. If different methods are found, there is a warning about 'incompatible methods': in that case or if no method is found for either argument the internal method is

Re: [Rd] Incompatible methods for overloaded operator

2012-06-20 Thread Winston Chang
On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan mtmor...@fhcrc.org wrote: On 06/20/2012 08:06 PM, Hadley Wickham wrote: But aren't the methods compatible? If equality doesn't make a method compatible what does? Actually I guess that turns out to be the key (to why they work at the

[Rd] Incompatible methods for overloaded operator

2012-06-14 Thread Winston Chang
I'm trying to overload an operator, and I'm running into a strange problem. It happens when I install and load the package, but not when I simply source() the code. I'm defining + for two classes. The R code looks like this: #' @export #' @method + a `+.a` - function (x1, x2) {