Report the patches or the turtles among agents which have their variable equals to specific values.

NLwith(agents, world, var, val)

# S4 method for matrix,worldMatrix,missing
NLwith(agents, world, val)

# S4 method for matrix,worldArray,character
NLwith(agents, world, var, val)

# S4 method for agentMatrix,missing,character
NLwith(agents, var, val)

## 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. WorldMatrix or worldArray object. Character. The name of the selected agents variable. If agents are patches and the world is a worldMatrix object, var must not be provided. If agents are patches and the world is a worldArray object, var is the name of the layer to use to define the patches values. If agents are turtles, var is one of the turtles' variable and can be equal to xcor, ycor, any of the variables created when turtles were created, as well as any variable created using turtlesOwn(). Numeric or character. Vector of any length.

## Value

Matrix (ncol = 2) with the first column pxcor and the second column pycor representing the coordinates of the patches among the agents which have their variable equals to any val, or

AgentMatrix representing the turtles among the agents which have their variable var equals to any val.

## Details

world must not be provided if agents are turtles.

This is equivalent in R to subsetting.

## References

Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

# Patches
t3 <- NLwith(agents = t1, var = "breed", val = c("sheep", "wolf"))