hatch: Hatch new 'turtles'

hatchR Documentation

Hatch new turtles

Description

Create new turtles from parent turtles.

Usage

hatch(turtles, who, n, breed)

## S4 method for signature 'agentMatrix,numeric,numeric'
hatch(turtles, who, n, breed)

Arguments

turtles

AgentMatrix object representing the moving agents.

who

Integer. Vector of the who numbers for the selected turtles.

n

Integer. Vector of length 1 or of length who. Number of new turtles to create for each parent.

breed

Character. One breed name. If missing, the created turtles are of the same breed as their parent turtle.

Details

The parent turtle must be contained in the turtles.

     The created `turtles` inherit of all the data from the parent `turtle`,
     except for the `breed` if specified otherwise, and for the `who` numbers.
     The `who`" numbers of the `turtles` created take on following the highest
     `who` number among the `turtles`.

     All new hatched `turtles` are placed at the end of the `agentMatrix` object.

Value

AgentMatrix representing the turtles with the new hatched ones.

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#hatch

Examples

w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
t1 <- createTurtles(n = 10, world = w1)
NLcount(t1)
t1 <- hatch(turtles = t1, who = 0, n = 2)
NLcount(t1)



NetLogoR documentation built on Aug. 17, 2022, 9:06 a.m.