rgenericsmatrixr-s3single-dispatch

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


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?


Solution

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

    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()))