| isNLclass | R Documentation |
Report TRUE if the agents is of the class tested,
report FALSE otherwise.
isNLclass(agents, class)
## S4 method for signature 'matrix,character'
isNLclass(agents, class)
agents |
Matrix ( `AgentMatrix` object representing the moving `agents`. |
class |
Character. Can take one of the following options to define
the |
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"`.
Logical. TRUE if agents is of the class tested.
Sarah Bauduin
Wilensky, U. 1999. NetLogo. https://www.netlogo.org. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
https://docs.netlogo.org/dictionary.html#is-of-type
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.