Description Usage Arguments Details Value Author(s) See Also Examples
NLDoReport
executes a NetLogo command (submitted as a string)
in the NetLogo instance for more than one time, and executes the reporter after each iteration.
It works like a combination of NLReport
and NLDoCommand
.
1 2 | NLDoReport(iterations, command, reporter, as.data.frame=FALSE,
df.col.names=NULL, nl.obj=NULL)
|
iterations |
An integer defining how many times the command is repeated. |
command |
A string with the NetLogo command to be executed. |
reporter |
A string containing a NetLogo reporter.
This argument can also be an R vector containing multiple strings with different NetLogo reporters (separated by commas), like |
as.data.frame |
(optional) If |
df.col.names |
(optional) If |
nl.obj |
(optional) A string identifying a reference to a NetLogo instance created with |
This function is used to execute a command more than one time and report a value or a number of values after each iteration. It is often used to call a procedure (e.g. "go") for a defined number of times and save the value of a state variable each time.
A list/nested list or data.frame with the value(s) of the reporter after each execution of the command.
Jan C. Thiele <rnetlogo@gmx.de>
NLDoCommand
,
NLReport
,
NLDoReportWhile
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
nl.path <- "C:/Program Files/NetLogo 6.0/app"
NLStart(nl.path)
model.path <- "/models/Sample Models/Earth Science/Fire.nlogo"
NLLoadModel(paste(nl.path,model.path,sep=""))
NLCommand("setup")
burned10 <- NLDoReport(10, "go", "burned-trees")
initburned10 <- NLDoReport(10, "go", c("initial-trees","burned-trees"),
as.data.frame=TRUE, df.col.names=c("initial","burned"))
str(initburned10)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.