<<<<<<< HEAD Values of an agents variable — of • NetLogoR

Report the agents values for the requested variable.

of(world, agents, var)

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

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

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

Arguments

world

WorldMatrix or worldArray object.

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

var

Character. Vector of the names of the selected agents variables. 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 layers to use to define the patches values. If agents are turtles, var is some of the turtles' variable and can be any of the variables created when turtles were created, as well as any variable created with turtlesOwn().

Value

Vector of values for the agents if one variable is requested. The class depends of the variable class. The order of the vector follows the order of the agents, or

    Matrix or `Dataframe` (`ncol` = `length(var)`, `nrow` = `NLcount(agents)`)

    if more than one variable is requested. The row order

    follows the order of the `agents`.

Details

world must be provided only if agents are patches.

References

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

Author

Sarah Bauduin

Examples

# Patches
w1 <- createWorld(
  minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
  data = 1:25
)
of(world = w1, agents = patch(w1, c(0, 0), c(4, 0)))
#> [1]  1 21

# Turtles
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
of(agents = t1, var = "heading")
#>  [1]  46.22797 250.01927 279.96067 104.05308  83.98745 236.38700 199.69832
#>  [8] 192.16767 315.22501 323.43489

======= Values of an agents variable — of • NetLogoR

Report the agents values for the requested variable.

of(world, agents, var)

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

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

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

Arguments

world

WorldMatrix or worldArray object.

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

var

Character. Vector of the names of the selected agents variables. 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 layers to use to define the patches values. If agents are turtles, var is some of the turtles' variable and can be any of the variables created when turtles were created, as well as any variable created with turtlesOwn().

Value

Vector of values for the agents if one variable is requested. The class depends of the variable class. The order of the vector follows the order of the agents, or

    Matrix or `Dataframe` (`ncol` = `length(var)`, `nrow` = `NLcount(agents)`)
    if more than one variable is requested. The row order
    follows the order of the `agents`.

Details

world must be provided only if agents are patches.

References

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

Author

Sarah Bauduin

Examples

# Patches
w1 <- createWorld(
  minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4,
  data = 1:25
)
of(world = w1, agents = patch(w1, c(0, 0), c(4, 0)))
#> [1]  1 21

# Turtles
t1 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
of(agents = t1, var = "heading")
#>  [1] 201.79468   1.69115 349.69923 142.47032 299.17004  41.76696 296.39122
#>  [8] 105.34220 101.81279 153.97372

>>>>>>> development