Build and Run Spatially Explicit Agent-Based Models

Build and run spatially explicit agent-based models using only the R platform. 'NetLogoR' follows the same framework as the 'NetLogo' software (Wilensky, 1999 < http://ccl.northwestern.edu/netlogo/>) and is a translation in R of the structure and functions of 'NetLogo'. 'NetLogoR' provides new R classes to define model agents and functions to implement spatially explicit agent-based models in the R environment. This package allows benefiting of the fast and easy coding phase from the highly developed 'NetLogo' framework, coupled with the versatility, power and massive resources of the R software. Examples of three models (Ants < http://ccl.northwestern.edu/netlogo/models/Ants>, Butterfly (Railsback and Grimm, 2012) and Wolf-Sheep-Predation < http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation>) written using 'NetLogoR' are available. The 'NetLogo' code of the original version of these models is provided alongside. A programming guide inspired from the 'NetLogo' Programming Guide (< https://ccl.northwestern.edu/netlogo/docs/programming.html>) and a dictionary of 'NetLogo' primitives (< https://ccl.northwestern.edu/netlogo/docs/dictionary.html>) equivalences are also available. NOTE: To increment 'time', these functions can use a for loop or can be integrated with a discrete event simulator, such as 'SpaDES' (< https://cran.r-project.org/package=SpaDES>). The suggested package 'fastshp' can be installed with 'install.packages("fastshp", repos = " https://rforge.net", type = "source")'.


Appveyor Build status Build Status Coverage Status CRAN_Status_Badge Downloads

Build and run spatially explicit agent-based models in R

NetLogoR is an R package to build and run spatially explicit agent-based models using only the R platform. It follows the same framework as NetLogo (Wilensky, 1999) and is a translation in R language of the structure and functions of NetLogo (NetLogo primitives). NetLogoR provides new R classes to define model agents and functions to implement spatially explicit agent-based models in the R environment. This package allows benefiting of the fast and easy coding phase from the highly developed NetLogo's framework, coupled with the versatility, power and massive resources of the R software.

Getting Started

Examples of three models (Ants, Butterfly (Railsback and Grimm, 2012) and Wolf-Sheep-Predation) written using NetLogoR are available. The NetLogo code of the original version of these models is provided alongside. A programming guide inspired from the NetLogo Programming Guide and a dictionary of NetLogo primitives equivalences are also available.

Installing NetLogoR

From GitHub

#install.packages("devtools")
devtools::install_github("PredictiveEcology/NetLogoR")

News

Known issues: https://github.com/PredictiveEcology/NetLogoR/issues

Version 0.3.5

  • Updates to fix CRAN check problems.

Version 0.3.4

  • Set random seed in two tests.

Version 0.3.3

  • Add sf to Suggests, as it is used in tests.

Version 0.3.2

  • Fix bug in turtlesOn(). Error when the world was not square.
  • Fix use of suggested packages in tests.

Version 0.3.1

  • First CRAN release.

Version 0.3.0

  • inRadius now multiplies the width by a tiny amount so that the function returns an inclusive result.
  • Add quickPlot >= 0.1.1.9000 dependency.
  • Update dependencies on SpaDES-related packages to only include the ones actually used.
  • Define [[ and $ for worldArray to extract subset layers.
  • Add show methods for worldMatrix and worldArray, similar to RasterLayer and RasterStack.
  • Add tools so quickPlot::Plot works, e.g., Plot(agentMatrixObj) or Plot(worldMatrixObj) or Plot(worldArrayObj), Plot(worldArrayObj$layer1). addTo argument implemented for layering, Plot(worldMatrixObj); Plot(agentMatrixObj, addTo="worldMatrixObj") will plot the agents on the map.

Version 0.2.0

  • Minimum R version increased from 3.2.5 to 3.3.0 as required by dependency RandomFieldsUtils.

Version 0.1.0

  • All key NetLogo functions rewritten in R, except visualizations and "links" agents.
  • Adapted plot methods.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("NetLogoR")

0.3.5 by Sarah Bauduin, 2 months ago


http://netlogor.predictiveecology.org, https://github.com/PredictiveEcology/NetLogoR/


Report a bug at https://github.com/PredictiveEcology/NetLogoR/issues


Browse source code at https://github.com/cran/NetLogoR


Authors: Sarah Bauduin [aut, cre] , Eliot J B McIntire [aut] , Alex M Chubaty [aut] , Her Majesty the Queen in Right of Canada , as represented by the Minister of Natural Resources Canada [cph]


Documentation:   PDF Manual  


GPL-3 license


Imports abind, car, CircStats, data.table, grDevices, Hmisc, matrixStats, methods, plyr, quickPlot, sp, SpaDES.tools, stats, rgeos

Depends on raster

Suggests fastshp, knitr, magrittr, microbenchmark, rmarkdown, sf, SpaDES.core, testthat


See at CRAN