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) {
message("Run
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.
Hadley
On Wed, Jun 13, 2012 at 7:41 PM, Winston Chang wrote:
> I'm trying to overload an operator, and I'm running into a strange problem.
> It happens when I i
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
> 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 w
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 i
On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan 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
> command line b
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 :
> On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan wrote:
>
>> On
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 argu
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 w