Hi all, I'm trying to implement the matrix multiplication operator, which is S4 generic, for an old-style S3 class. The following works as expected:
x <- 1:10 class(x) <- "myClass" setOldClass("myClass") setGeneric("myMethod", function(x, y) standardGeneric("myMethod")) setMethod("myMethod", c("myClass", "myClass"), function(x, y) message("dispatched!")) myMethod(x, x) #> dispatched! but I don't understand why the following won't: setMethod("%*%", c("myClass", "myClass"), function(x, y) message("dispatched!")) x %*% x #> [,1] #> [1,] 385 Is this approach wrong? Regards, Iñaki ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel