Skip to content
Prev 20272 / 63421 Next

S4 method dispatch matrixOrArray (fwd)

Thanks for your in-depth explanation. I had noticed the difference
in order in showMethods() output but was unsure whether that was
indicative of the problem or if I was somehow taking advantage of
an undocumented implementation-specific detail.

If I could, I'd like to go back to the original question from
the R-help post here. The original method was doing its real
dispatching on the arguments of the example that were represented
by the dots. The meat of the method was to manipulate array
objects and as such I didn't want to repeat numerous array methods
as matrix methods (code duplication with the only difference being
the first argument). From another recent posting on a similar topic,
I wanted to do something along the lines of

    setClassUnion("matrixOrArray", c("matrix", "array"))

but that didn't work as originally presented (probably due to
your comment on matrix/array weirdness). So my other question
would be:

3 - Is there a way to use the class union such that I don't have
to duplicate the code unnecessarily yet avoid the setMethod
ordering issue and clarify the original intention?
On Thu, 13 Apr 2006, John Chambers wrote:

            
----------------------------------------------------------
SIGSIG -- signature too long (core dumped)