initialize-Agent-method: Initialize an object of class "Agent".

Description Usage Arguments See Also Examples

Description

The initialize function sets the values for the slots of an object of class Agent.

Usage

1
2
3
## S4 method for signature 'Agent'
initialize(.Object, location = numeric(0),
  velocity = numeric(0), active = logical(0))

Arguments

.Object

An object of class Agent.

location

A numerical vector of length 2 specifying the x- and y-position of the object of class Agent [Default: c(0, 0)].

velocity

A numerical vector of length 2 specifying the velocity in the x- and y-direction of the object of class Agent [Default: c(0, 0)].

active

A length-one logical vector indicating whether the object of class Agent is active (TRUE) or not (FALSE) [Default: TRUE].

See Also

Agent, Agent-class, validAgentObject

Examples

1
2
3
4
5
6
7
8
a <- new("Agent")
print(a)
a <- initialize(a,
                location = c(1.23, 10.5),
                velocity = c(5 * sqrt(2), 5 * sqrt(2)),
                active = FALSE)
validAgentObject(a)
print(a)

mverouden/rsfour documentation built on May 25, 2019, 5:01 a.m.