| patchAt {NetLogoR} | R Documentation |
Patches at
Description
Report the coordinates of the patches at (dx, dy) distances of the agents.
Usage
patchAt(world, agents, dx, dy, torus = FALSE)
## S4 method for signature 'worldNLR,matrix,numeric,numeric'
patchAt(world, agents, dx, dy, torus = FALSE)
Arguments
world |
|
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 |
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,
NA are returned
for the patch coordinates;
if torus = TRUE, the patch coordinates from a wrapped world are
returned.
Value
Matrix (ncol = 2) with the first column pxcor and the second column
pycor representing the coordinates of the patches at (dx, dy)
distances of the agents. The order of the patches follows the order
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#patch-at
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#at-points
Examples
w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9)
patchCorner <- patchAt(world = w1, agents = patch(w1, 0, 0), dx = 1, dy = 1)
t1 <- createTurtles(n = 1, coords = cbind(xcor = 0, ycor = 0))
patchCorner <- patchAt(world = w1, agents = t1, dx = 1, dy = 1)