[Bioc-devel] mapping variadic calls to binary calls for dispatch

Michael Lawrence lawrence.michael at gene.com
Wed Apr 22 20:35:48 CEST 2015


Hi guys,

In R 3.2 we (mostly Martin Maechler) made it so that c/rbind delegate to
c/rbind2 for S4 objects, even when there is a mixture of classes in "...".
There are more such cases, like (p)max and (p)min. The functions min and
max are overridable via the Summary group generic, but dispatch only
happens on the first arg. In practice, that's just fine.

But for the "p" variants, things do not work so well. One simple solution
is just to override the function entirely, without defining a generic. The
wrapper would just delegate to pmin2() or pmax2() via Reduce(). The default
methods for pmin2 and pmax2 would just fallback to the original pmin and
pmax. That would make things like pmin(rle, 0) work. But it would also slow
down do.call(pmin, as.data.frame(m)) for getting the row-wise mins of a
matrix with many columns. So maybe we need a heuristic in C as with cbind?
Or can we do something with BiocGenerics and expect people to use
matrixStats for big matrices instead?

Michael

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list