Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/NLSetAgentSet.R
NLSetAgentSet
is an easy way to set the variable value(s) of one or more agent(s) (by specifying the name of the agent or the name of an agentset containing the agents) to the value(s) of a data.frame or vector.
1 | NLSetAgentSet(agentset, input, var.name=NULL, nl.obj=NULL)
|
agentset |
A string specifying the agent or agentset for which values should be changed. |
input |
A data.frame or vector.
If a data.frame, it must have one column with the corresponding agent variable name for each agent variable to be set and one row for each agent.
The rows have to be sorted in the order NetLogo is processing the agentset with |
var.name |
If |
nl.obj |
(optional) A string identifying a reference to a NetLogo instance created with |
The agent variable values contained as columns in the input data.frame are changed. The columns of the data.frame have to be named exactly like the
agent variable which should get the values. The rows have to be sorted as NetLogo would process the agentset using the sort
reporter.
No return value.
Jan C. Thiele <rnetlogo@gmx.de>
NLSetPatches
,
NLGetAgentSet
,
NLGetGraph
,
NLDfToList
1 2 3 4 5 6 7 8 9 | ## Not run:
nl.path <- "C:/Program Files/NetLogo 6.0/app"
NLStart(nl.path)
# NLLoadModel(...)
ag <- NLGetAgentSet(c("xcor","ycor"),"turtles")
ag2 <- data.frame(xcor=ag$xcor, ycor=ag$xcor)
NLSetAgentSet("turtles", ag2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.