minOneOf {NetLogoR} | R Documentation |
One agent
with minimum
Description
Report one patch
or one turtle
among agents
which has its variable equals
to the minimum value.
Usage
minOneOf(agents, world, var)
## S4 method for signature 'matrix,worldMatrix,missing'
minOneOf(agents, world)
## S4 method for signature 'matrix,worldArray,character'
minOneOf(agents, world, var)
## S4 method for signature 'agentMatrix,missing,character'
minOneOf(agents, var)
Arguments
agents |
Matrix ( `AgentMatrix` object representing the moving `agents`. |
world |
|
var |
Character. The name of the selected |
Details
world
must not be provided if agents
are turtles.
If there are several `patches` or `turtles` among `agents` with their variable equal to the minimum value, one is chosen randomly. To access to all `patches` or `turtles` among `agents` which have their variable equal to the minimum value, use `withMin()`.
Value
Matrix (ncol
= 2, nrow
= 1) with the first column pxcor
and
the second column pycor
representing the coordinates of the patch
(or of one of the patches
) among the agents
which has its variable
equals to the minimum value
among the agents
, or
`AgentMatrix` of length 1 representing the `turtle` (or one of the `turtles`) among the `agents` which has its variable `var` equals to the minimum value among the `agents`.
Author(s)
Sarah Bauduin
References
Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
See Also
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#min-one-of
Examples
# Patches
w1 <- createWorld(
minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
data = sample(1:5, size = 25, replace = TRUE)
)
plot(w1)
p1 <- minOneOf(agents = patches(w1), world = w1)
# Turtles
t1 <- createTurtles(
n = 10, coords = randomXYcor(w1, n = 10),
heading = sample(1:3, size = 10, replace = TRUE)
)
t2 <- minOneOf(agents = t1, var = "heading")