Netlogo is a powerful platform for simulation while its mathimatical calculation is relatively poor comparing to some specific softwares. So it is a good idea to embedd R in Netlogo so that the problem can be solved. This article will show you hao to do the “A” in the upside picture which comes from http://jasss.soc.surrey.ac.uk/15/3/8.html.

You can get some help from the official website of the ones who created it :

or you can just do the following steps:

1. Install R:
and you can get some reference frome http://zlethic.com/?p=690

2. Install Netlogo:
For Linux users, you just need to download the package from:
Decompress it and you can see “netlogo.sh” and “netlogo-3D.sh”.

3. Dowload the R-extension package:
decompress it and copy it to the “extention” folder in your Netlogo folder.

4. Then you can see “r” folder in your “extensions” folder, open “r” folder and the manual is in the “doc” folder: r-extension.html. You can see many details in it.

5. rJava is needed:
For Debian Linux, just type in your terminal:
sudo apt-get install r-cran-rjava

6. Edit the Path Variable:
in Your Home: sudo vim .profile
For most Unbuntu users you can add this at the end, you should modify this according to your condition:
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-i386
export R_HOME=/usr/lib/R
export JRI_HOME=/usr/lib/R/site-library/rJava/jri

7. Test:
Open your “r” folder in your “extensions” folder and copy “rsystemcheck” to “extensions”, excute netlogo and open “Systemcheck.nlogo” and you can make some test to see if everything is properly installed.

8. Examples:
They are in extensions/r/examples/. For most of them, extral r packages are needed.
Type R in terminal and you can get into R, then type: install.packages(package_name).