| createTurtles | R Documentation |
turtlesCreate n moving agents with a set of defined variables.
createTurtles(n, coords, world, heading, breed, color)
## S4 method for signature 'numeric,matrix,missing'
createTurtles(n, coords, world, heading, breed, color)
## S4 method for signature 'numeric,missing,ANY'
createTurtles(n, coords, world, heading, breed, color)
n |
Integer. |
coords |
Matrix ( |
world |
|
heading |
Numeric. Vector of values between 0 and 360. Must be of length 1 or
of length |
breed |
Character. Vector of |
color |
Character. Vector of |
If coords is provided, world must not be provided.
The identity of the `turtles` is defined by their `who` number. This
numbering starts at 0 and increments by 1.
The coordinates from the previous time step are stored in `prevX` and
`prevY`. The initial values are `NA`.
AgentMatrix object of length n with data for the
turtles being: xcor, ycor, who, heading, prevX, prevY,
breed, and color.
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#create-turtles
w1 <- createWorld(
minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
data = runif(25)
)
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
plot(w1)
points(t1, col = of(agents = t1, var = "color"), pch = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.