[R] Overloading %*%

knoblauch knoblauch at lyon.inserm.fr
Sun Mar 16 21:49:25 CET 2008


Joe Cainey <jcainey <at> gmail.com> writes:
> Is it possible to supply a new method for the %*% operator? 
clipped
> I've tried to do the same thing with %*%:
> 
> "%*%.ad" <- function(a,b)
> {
>     # further code here
> }
> However this doesn't work; the new method is never called and the standard
> %*% operator is used instead. I've had a look at the documentation and it
> appears to be because the %*% operator is not part of the "Math", "Ops",
> "Summary" or "Complex" groups. I was wondering if anybody knew of a
> work-around for this?
According to the help page for %*%, it is S4 generic but not S3, so
you might make further progress using S4 methods.

> Thanks,
> 
> Joe Cainey
> 
best,

Ken



More information about the R-help mailing list