Report one patch
or turtle
randomly selected among agents
.
oneOf(agents)
# S4 method for matrix
oneOf(agents)
Matrix (ncol
= 2) with the first column pxcor
and the second
column pycor
representing the patches
coordinates, or
Matrix (ncol
= 2, nrow
= 1) with the first column pxcor
and the second column pycor
representing the coordinates of the
selected patch
from agents
, or
Matrix (`ncol` = 2) with the first column `pxcor`
and the second column `pycor` representing the coordinates of the
selected `patches` from `agents`, one per individual `id`, or
`AgentMatrix` object representing the `turtle`
selected from `agents`, or
Integer. Vector of `who` numbers for the selected `turtles` from
`agents`, one per individual `id`.
If agents
is a matrix with ncol
= 3, the selection of one
random patch
is done per individual id
. The order of the patches
coordinates returned follow the order of id
.
If agents
is a matrix (ncol
= 2) with columns whoTurtles
and
id
, the selection of one random turtle
(defined by their whoTurtles
)
is done per individual id
. The order of the who
numbers returned
follow the order of id
.
Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
# Patches
w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
pSelect <- oneOf(agents = patches(w1))
# Turtles
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
tSelect <- oneOf(agents = t1)