Report the patches or turtles among agents2 within given distances of each of the agents. Currently, this function multiplies radius by 1.0000001 so that the response of inRadius is inclusive.

inRadius(agents, radius, agents2, world, torus = FALSE)

# S4 method for matrix,numeric,matrix
torus = FALSE)

## 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. Numeric. Vector of distances from agents to locate agents2. Must be of length 1 or of length 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. Logical to determine if the world is wrapped. Default is torus = FALSE.

## Value

Matrix (ncol = 3) with the first column pxcor and the second column pycor representing the coordinates of the patches among agents2 within radius distances for each agents which are represented by the id column, if agents2 are patches, or

Matrix (ncol = 2) with the first column who representing the who numbers of the turtles among agents2 within radius distances for each agents which are represented by the id column, if agents2 are turtles.

## Details

Distances from/to patches are calculated from/to their center.

If torus = FALSE, world does not need to be provided.

If torus = TRUE, the radius distances are calculated around the sides of the world to select agents2.

## References

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

w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
t3 <- inRadius(agents = turtle(t1, who = 0), radius = 2, agents2 = t1)