| turtlesAt {NetLogoR} | R Documentation |
Turtles at
Description
Report the individuals among turtles that are located on the patches at
(dx, dy) distances of the agents.
Usage
turtlesAt(world, turtles, agents, dx, dy, breed, torus = FALSE)
## S4 method for signature
## 'worldNLR,agentMatrix,matrix,numeric,numeric,missing'
turtlesAt(world, turtles, agents, dx, dy, torus)
## S4 method for signature
## 'worldNLR,agentMatrix,matrix,numeric,numeric,character'
turtlesAt(world, turtles, agents, dx, dy, breed, torus = FALSE)
Arguments
world |
|
turtles |
|
agents |
Matrix ( `AgentMatrix` object representing the moving `agents`. |
dx |
Numeric. Vector of distances to the east (right) from the |
dy |
Numeric. Vector of distances to the north (up) from the |
breed |
Characters. Vector of |
torus |
Logical to determine if the |
Details
If the patch at distance (dx, dy)
of an agent is outside of the world's extent and torus = FALSE,
no turtle is returned;
if torus = TRUE, the turtle located on the patch whose coordinates
are defined from the wrapped world is returned.
Value
AgentMatrix representing the individuals among turtles
of any of the given breed, if specified,
which are located on the patches at (dx, dy) distances of 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#turtles-at
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#at-points
Examples
w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9)
t1 <- createTurtles(
n = 10, coords = cbind(xcor = 0:9, ycor = 0:9),
breed = c(rep("sheep", 5), rep("wolf", 5))
)
t2 <- turtlesAt(
world = w1, turtles = t1, agents = turtle(t1, who = 0),
dx = 1, dy = 1
)
t3 <- turtlesAt(
world = w1, turtles = t1,
agents = patch(w1, c(3, 4, 5), c(3, 4, 5)), dx = 1, dy = 1,
breed = "sheep"
)