Call a method on an object regardless of its OOP type.

OOP_type_independent_method(object, method)

Arguments

object

any. An R object of variable OOP type (S3, S4, RC, R6).

method

character. The method to call on the object. If the latter is a reference class, it use the $ operator to access the method. (For example, object$some_method). If it has an attribute with the name method, it will use that attribute as the method to call. Otherwise, it will try to fetch a generic with the name method using get.