| oneOf | R Documentation |
agentReport one patch or turtle randomly selected among agents.
oneOf(agents)
## S4 method for signature 'matrix'
oneOf(agents)
agents |
Matrix ( Matrix (`ncol` = 3) with the first column "`pxcor` and the second
column `pycor` representing the `patches` coordinates and the
third column `id`, or
`AgentMatrix` object representing the moving `agents`, or
Matrix (`ncol` = 2) with the first column `whoTurtles` and the
second column `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.
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`.
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#one-of
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.