createOTurtles: Create ordered 'turtles'

createOTurtlesR Documentation

Create ordered turtles

Description

Create n turtles at the center of the world with their headings evenly distributed.

Usage

createOTurtles(n, world, breed, color)

## S4 method for signature 'numeric'
createOTurtles(n, world, breed, color)

Arguments

n

Integer.

world

WorldMatrix or worldArray object.

breed

Character. Vector of breed names. Must be of length 1 or of length n. If missing, breed = "turtle" for all turtles.

color

Character. Vector of color names. Must be of length n. If missing, colors are assigned using the function rainbow(n).

Details

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`.

Value

AgentMatrix object of length n with data for the turtles being: xcor, ycor, who, heading, prevX, prevY, breed, and color.

Author(s)

Sarah Bauduin and Eliot McIntire

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#create-ordered-turtles

Examples

w1 <- createWorld(
  minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
  data = runif(25)
)
t1 <- createOTurtles(n = 10, world = w1)
plot(w1)
points(t1, col = of(agents = t1, var = "color"), pch = 16)

t1 <- fd(turtles = t1, dist = 1)
points(t1, col = of(agents = t1, var = "color"), pch = 16)


PredictiveEcology/NetLogoR documentation built on Jan. 31, 2024, 9:31 p.m.