Re: [Rd] S4 method implementation for S3 class

2017-09-24 Thread Joris Meys
You can always check eg the Matrix package to show you how it's done. Cheers Joris On Sat, Sep 23, 2017 at 6:17 PM, Iñaki Úcar wrote: > > There is formally no such thing as an S3 class. Just S3 objects with a > > class attribute. You could extend a base class with an S4 class, like > > setClass

Re: [Rd] S4 method implementation for S3 class

2017-09-23 Thread Iñaki Úcar
> There is formally no such thing as an S3 class. Just S3 objects with a > class attribute. You could extend a base class with an S4 class, like > setClass("IntegerWithUnits", slots=c(units="Units"), > contains="integer"). Sure, that's a disruptive change, but it would be > in the right direction.

Re: [Rd] S4 method implementation for S3 class

2017-09-22 Thread Michael Lawrence
On Fri, Sep 22, 2017 at 10:28 AM, Iñaki Úcar wrote: > 2017-09-22 19:04 GMT+02:00 Michael Lawrence : >> The %*% function is a primitive. As it says in the documentation under >> ?Methods_Details >> >> Methods may be defined for most primitives, and corresponding >> metadata objects will b

Re: [Rd] S4 method implementation for S3 class

2017-09-22 Thread Iñaki Úcar
2017-09-22 19:04 GMT+02:00 Michael Lawrence : > The %*% function is a primitive. As it says in the documentation under > ?Methods_Details > > Methods may be defined for most primitives, and corresponding > metadata objects will be created to store them. Calls to the > primitive still

Re: [Rd] S4 method implementation for S3 class

2017-09-22 Thread Michael Lawrence
The %*% function is a primitive. As it says in the documentation under ?Methods_Details Methods may be defined for most primitives, and corresponding metadata objects will be created to store them. Calls to the primitive still go directly to the C code, which will sometimes che

[Rd] S4 method implementation for S3 class

2017-09-22 Thread Iñaki Úcar
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("