Do any generic functions in the base library dispatch on matrices?

123 Views Asked by At

I'm having some trouble writing some code that dispatches on matrices. To assist me, I'd like to see what generic functions in the base library dispatch on matrices. Is there any way to get R to give me a list of them? Failing that, does anyone know of any members of that list?

1

There are 1 best solutions below

3
On BEST ANSWER

There are at least seven functions in base R that have matrix generics:

  • anyDuplicated
  • determinant
  • duplicated
  • isSymmetric
  • subset
  • summary
  • unique

you can get them with

getS3method("anyDuplicated", class="matrix")

or just

anyDuplicated.matrix

Found using

Filter(function(x) {
  !is.null(getS3method(x, class="matrix", optional=TRUE))
},ls(all.names=TRUE, env = baseenv()))