Returns the default arguments associated with the respective lcMethod subclass. These arguments are automatically included into the lcMethod object during initialization.

getArgumentDefaults(object, ...)

# S4 method for class 'lcMethod'
getArgumentDefaults(object)

Arguments

object

The method specification object.

...

Not used.

Value

A named list of argument values.

Implementation

Although implementing this method is optional, it prevents users from having to specify all arguments every time they want to create a method specification.

In this example, most of the default arguments are defined as arguments of the function lcMethodExample, which we can include in the list by calling formals. Copying the arguments from functions is especially useful when your method implementation is based on an existing function.


setMethod("getArgumentDefaults", "lcMethodExample", function(object) {
  list(
    formals(lcMethodExample),
    formals(funFEM::funFEM),
    extra = Value ~ 1,
    tol = 1e-4,
    callNextMethod()
  )
})

It is recommended to add callNextMethod() to the end of the list. This enables inheriting the default arguments from superclasses.