Report the directions of each `agents`

towards each corresponding `agents2`

.

```
towards(agents, agents2, world, torus = FALSE)
# S4 method for matrix,matrix
towards(agents, agents2, world, torus = FALSE)
```

- 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`.`

- agents2
Matrix (

`ncol`

= 2) with the first column`pxcor`

and the second column`pycor`

representing the`patches`

coordinates, or``AgentMatrix` object representing the moving `agents`, or Matrix (`ncol` = 2) with the first column `x` and the second column `y` representing locations coordinates.`

- world
`WorldMatrix`

or`worldArray`

object.- torus
Logical to determine if the

`world`

is wrapped. Default is`torus = FALSE`

.

Numeric. Vector of angles in degrees of length equal to the largest
number of agents/locations between `agents`

and `agents2`

.

`agents`

and `agents2`

must have the same number of agents/locations
or if different, one of them must have only one agent/location. If
`agents`

and `agents2`

have the same number of agents/locations,
the directions are calculated for each pair `agents[i]`

and `agents2[i]`

and not for each `agents`

towards every single `agents2`

.

```
`torus = FALSE`, `world` does not need to be provided.
If
`torus = TRUE` and the distance from one `agents` to
If `agents2` is smaller around the
its corresponding `world` than across it, then the direction to `agents2`
sides of the `world` is returned.
going around the sides of the
0; the direction from
The direction from a patch to its location returns 's heading. a turtle to its location returns the turtle
```

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

https://ccl.northwestern.edu/netlogo/docs/dictionary.html#towards

`<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#towardsxy> `

```
w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
towards(agents = patches(w1), agents2 = cbind(x = 0, y = 0))
#> [1] 180.0000 194.0362 206.5651 216.8699 225.0000 180.0000 198.4349 213.6901
#> [9] 225.0000 233.1301 180.0000 206.5651 225.0000 236.3099 243.4349 180.0000
#> [17] 225.0000 243.4349 251.5651 255.9638 0.0000 270.0000 270.0000 270.0000
#> [25] 270.0000
t1 <- createTurtles(n = 10, world = w1)
towards(agents = t1, agents2 = cbind(x = 0, y = 0))
#> [1] 225 225 225 225 225 225 225 225 225 225
```