| of | R Documentation |
agents variableReport the agents values for the requested variable.
of(world, agents, var)
## S4 method for signature 'missing,agentMatrix,character'
of(agents, var)
## S4 method for signature 'worldMatrix,matrix,missing'
of(world, agents)
## S4 method for signature 'worldArray,matrix,character'
of(world, agents, var)
world |
|
agents |
Matrix ( `AgentMatrix` object representing the moving `agents`. |
var |
Character. Vector of the names of the selected |
world must be provided only if agents are patches.
Vector of values for the agents if one variable is
requested. The class depends
of the variable class. The order of the vector follows the order
of the agents, or
Matrix or `Dataframe` (`ncol` = `length(var)`, `nrow` = `NLcount(agents)`)
if more than one variable is requested. The row order
follows the order of the `agents`.
Sarah Bauduin
Wilensky, U. 1999. NetLogo. https://www.netlogo.org. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
https://docs.netlogo.org/dictionary.html#of
# Patches
w1 <- createWorld(
minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
data = 1:25
)
of(world = w1, agents = patch(w1, c(0, 0), c(4, 0)))
# Turtles
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
of(agents = t1, var = "heading")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.