Skip to contents

Works for all objects that have an id-slot, such as all extensions of object-class, the agent-class, and the goal-class.

Usage

id(object)

id(object) <- value

# S4 method for class 'object'
id(object)

# S4 method for class 'object'
id(object) <- value

# S4 method for class 'goal'
id(object)

# S4 method for class 'goal'
id(object) <- value

# S4 method for class 'agent'
id(object)

# S4 method for class 'agent'
id(object) <- value

# S4 method for class 'predped'
id(object)

# S4 method for class 'predped'
id(object) <- value

Arguments

object

An instance of the object-class, agent-class, or goal-class.

value

Value with which to replace the original value of the id slot.

Details

Note that while the agent-class, circle-class, polygon-class, rectangle-class, and segment-class are not explicitly mentioned, this getter/setter works for these classes as well.#'

Examples

# Initialize agent
my_agent <- agent(center = c(0, 0), 
                  radius = 0.25, 
                  id = "my agent")

# Access the id slot for the agent
id(my_agent)
#>   my agent 
#> "my agent" 

# Change the id slot for the agent
id(my_agent) <- "renamed agent"
id(my_agent)
#>   renamed agent 
#> "renamed agent"