Re: [R] Overloading %*%

From: knoblauch <>
Date: Sun, 16 Mar 2008 20:49:25 +0000 (UTC)

Joe Cainey <jcainey <at>> writes:
> Is it possible to supply a new method for the %*% operator?
> I've tried to do the same thing with %*%:
> "%*" <- 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


Ken mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 16 Mar 2008 - 20:53:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 16 Mar 2008 - 23:30:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive