Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/NLSourceFromString.R
NLSourceFromString
is a way to create/append a NetLogo model's source code dynamically from R.
1 | NLSourceFromString(..., append.model=TRUE, nl.obj=NULL)
|
... |
An undefined number of strings containing NetLogo model source code to be printed into the procedures tab.
Line breaks within a string can be represented as |
append.model |
(optional) Determines whether existing code in the procedures tab (i.e. a loaded model) will be appended by the new code or will be replaced. By default, all existing code will be appended. |
nl.obj |
(optional) A string identifying a reference to a NetLogo instance created with |
This function only works with NetLogo instances with GUI. It doesn't work in headless mode.
No return value.
Jan C. Thiele <rnetlogo@gmx.de>
NLReport
,
NLGetAgentSet
,
NLGetGraph
,
NLDfToList
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
nl.path <- "C:/Program Files/NetLogo 6.0/app"
NLStart(nl.path)
setup <- "to setup\n ca\n crt 10\nend \n"
go <- "to go\n ask turtles [\n set xcor random-xcor\n
set ycor random-ycor\n ]\nend \n"
reporter1 <- "to-report noturtles\n report count turtles\n end \n"
NLSourceFromString(setup,go,reporter1, append.model=FALSE)
NLCommand("setup")
NLCommand("go")
noturtles <- NLReport("noturtles")
print(noturtles)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.