isNLclass {NetLogoR} | R Documentation |
Type of object
Description
Report TRUE
if the agents
is of the class
tested,
report FALSE
otherwise.
Usage
isNLclass(agents, class)
## S4 method for signature 'matrix,character'
isNLclass(agents, class)
Arguments
agents |
Matrix ( `AgentMatrix` object representing the moving `agents`. |
class |
Character. Can take one of the following options to define
the |
Details
Careful! The class
tested does not correspond to actual R classes.
`agents` is `"patch"` if it is a matrix (`ncol` = 2) with the first column `pxcor` and the second column `pycor` with only one row. `agents` is `"patcheset"` if the matrix has more than one row. `agents` is `"turtle"` if it is an `agentMatrix` containing only one `turtle`. `agents` is `"turtleset"` if the `agentMatrix` contains more than one `turtle`. `agents` is `"agent"` if it is either `"patch"` or `"turtle"`. `agents` is `"agentset"` if it is either `"patcheset"` or `"turtleset"`.
Value
Logical. TRUE
if agents
is of the class
tested.
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#is-of-type
Examples
w1 <- createWorld(minPxcor = 0, maxPxcor = 4, minPycor = 0, maxPycor = 4)
t1 <- createTurtles(
n = 10, coords = randomXYcor(w1, n = 10),
heading = sample(1:3, size = 10, replace = TRUE)
)
isNLclass(agents = patches(w1), class = "patch")
isNLclass(agents = patches(w1), class = "patcheset")
isNLclass(agents = t1, class = "agentset")
isNLclass(agents = t1, class = "turtleset")
[Package NetLogoR version 1.0.5 Index]