tExist: Do the 'turtle' exist?

tExistR Documentation

Do the turtle exist?

Description

Report TRUE if a turtle exists inside the turtles, report FALSE otherwise.

Usage

tExist(turtles, who, breed)

## S4 method for signature 'agentMatrix,numeric,missing'
tExist(turtles, who)

## S4 method for signature 'agentMatrix,numeric,character'
tExist(turtles, who, breed)

Arguments

turtles

AgentMatrix object representing the moving agents.

who

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

breed

Characters. Vector of breed names for the selected turtles. If missing, there is no distinction based upon breed.

Value

Logical. Vector of TRUE or FALSE if the who numbers with any of the breed, if provided, exist or not inside the turtles.

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

Examples

w1 <- createWorld(minPxcor = 0, maxPxcor = 9, minPycor = 0, maxPycor = 9)
t1 <- createTurtles(
  n = 10, coords = randomXYcor(w1, n = 10),
  breed = c(rep("sheep", 5), rep("wolf", 5))
)
tExist(turtles = t1, who = 3, breed = "sheep")
tExist(turtles = t1, who = 9, breed = "sheep")
tExist(turtles = t1, who = 9, breed = c("sheep", "wolf"))
tExist(turtles = t1, who = c(3, 9))


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