Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/NLDoReportWhile.R
NLDoReportWhile
function executes a NetLogo command (submitted as a string)
more than one time and executes the reporter after each iteration.
It works like NLDoReport
but will be repeated while the conditional reporter returns TRUE
.
1 2 | NLDoReportWhile(condition, command, reporter, as.data.frame=FALSE,
df.col.names=NULL, max.minutes=10, nl.obj=NULL)
|
condition |
A string with a NetLogo conditional reporter. |
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 |
max.minutes |
(optional) If |
nl.obj |
(optional) A string identifying a reference to a NetLogo instance created with |
This function executes a command more than one time and reports a value or a number of values after
each iteration. It is usually used to call a procedure (e.g. "go") while a variable is below a boundary value and save the value of a state variable each time.
Attention: Make sure that the condition switches from TRUE
to FALSE
sometime,
otherwise you will run an endless loop (which is stopped after 10 minutes by default, see argument max.minutes
).
A list/nested list with the value(s) of the reporter after each execution of the command.
Jan C. Thiele <rnetlogo@gmx.de>
NLDoCommandWhile
,
NLReport
,
NLDoReport
1 2 3 4 5 6 7 8 9 10 11 | ## 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")
burnedLower2200 <- NLDoReportWhile("burned-trees < 2200", "go",
"burned-trees")
str(burnedLower2200)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.