set_obj_method {struct} | R Documentation

## update method for a struct object

### Description

a helper function to update methods for a struct object

### Usage

    set_obj_method(
      class_name,
      method_name,
      definition,
      where = topenv(parent.frame()),
      signature = c(class_name, "DatasetExperiment")
    )

### Arguments

`class_name` | the name of the to update the method for
`method_name` | the name of the method to update. Must be an existing method for the object.
`definition` | the function to replace the method with. This function will be used when the method is called on the object.
`where` | the environment to create the object in. default where = topenv(parent.frame())
`signature` | a list of classes that this object requires as inputs. Default is c(class_name,'DatasetExperiment')

### Value

a method is created in the specified environment

### Examples

    set_struct_obj(
    class_name = 'add_two_inputs',
    struct_obj = 'model',
    params = c(input_1 = 'numeric', input_2 = 'numeric'),
    outputs = c(result = 'numeric'),
    prototype = list(
       input_1 = 0,
       input_2 = 0,
       name = 'Add two inputs',
       description = 'example class that adds two values together')
    )

[Package struct version 1.6.0 Index]