How to overload S4 slot selector `@` to be a generic function
问题 I am trying to turn the @ operator in R into a generic function for the S3 system. Based on the chapter in Writing R extensions: adding new generic I tried implementing the generic for @ like so: `@` <- function(object, name) UseMethod("@") `@.default` <- function(object, name) base::`@`(object, name) However this doesn't seem to work as it breaks the @ for the S4 methods. I am using Matrix package as an example of S4 instance: Matrix::Matrix(1:4, nrow=2, ncol=2)@Dim Error in @.default