R possesses a simple generic function mechanism which can be used for an object-oriented style of programming. Method dispatch takes place based on the class(es) of the first argument to the generic function or of the object supplied as an argument to UseMethod or NextMethod.
UseMethod(generic, object)<p></p><p>NextMethod(generic = NULL, object = NULL, …)</p>
| Parameter | Description |
|---|---|
generic |
a character string naming a function (and not a built-in operator). Required for UseMethod. |
object |
for UseMethod: an object whose class will determine the method to be dispatched. Defaults to the first argument of the enclosing function. |
… |
further arguments to be passed to the next method. |