NLcount: Count agents

NLcountR Documentation

Count agents

Description

Report the number of patches or turtles inside agents.

Usage

NLcount(agents)

## S4 method for signature 'matrix'
NLcount(agents)

Arguments

agents

Matrix (ncol = 2) with the first column pxcor and the second column pycor representing the patches coordinates, or

          `AgentMatrix` object representing the moving `agents`.

Value

Integer.

Author(s)

Sarah Bauduin

References

Wilensky, U. 1999. NetLogo. https://www.netlogo.org. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

See Also

https://docs.netlogo.org/dictionary.html#count

Examples

# Patches
w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
p1 <- patches(w1)
NLcount(p1) # 25 patches

# Turtles
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
NLcount(t1) # 10 turtles


NetLogoR documentation built on Sept. 9, 2025, 5:27 p.m.