NLStart
. Then load a model with the function
NLLoadModel
and then use commands and reporters to do what you like.
It is possible to use NetLogo 3D. Just set the is3d
argument in NLStart
to TRUE
. This functionality is experimental. All RNetLogo functions should work in NetLogo 3D as they do in conventional 2D NetLogo except NLSetPatches
, which is not implemented to work with NetLogo 3D properly. NLSetPatchSet
delivers a similar functionality usable also with NetLogo 3D but uses a data.frame instead of a matrix.
Note for MAC users: If you want to run RNetLogo in headless mode (without GUI, i.e. setting argument gui=FALSE
in NLStart
) you have to disable AWT before loading the package. Just execute Sys.setenv(NOAWT=1)
before executing library(RNetLogo)
.
If you want to run RNetLogo in GUI mode you have to start it from the JGR application (see Sys.setenv(NOAWT=1)
before loading the JGR package and run Sys.unsetenv("NOAWT")
before starting JGR via JGR()
.
Note for Linux users: If you want to run RNetLogo in GUI mode you should start RNetLogo from JGR (see Cstack_info()
you can see how large the C stack size is.
A workaround is to use R 2.15.1 or to start RNetLogo from JGR (see NLStart
.
See the tutorial located in folder "tutorial" in the installation path of the package for an introduction. Example codes for all functions can be found in the folder "examples" in the installation path of the package. For performance notes see the vignette "performanceNotes.pdf" and for an introduction how to run RNetLogo in parallel on multicore computers or clusters/grids see the vignette "parallelProcessing.pdf".NLStart,
NLLoadModel,
NLQuit,
rJava package
library(RNetLogo)
nl.path <- "C:/Program Files/NetLogo 5.0.3"
NLStart(nl.path, nl.version=5)
model.path <- "/models/Sample Models/Earth Science/Fire.nlogo"
NLLoadModel(paste(nl.path,model.path,sep=""))
NLCommand("setup")
NLDoCommand(10, "go")
burned <- NLReport("burned-trees")
print(burned)
Run the code above in your browser using DataLab