Package: NetLogoR 1.0.5.9001

Eliot J B McIntire

NetLogoR: 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 two models from the NetLogo software repository (Ants <http://ccl.northwestern.edu/netlogo/models/Ants>) and Wolf-Sheep-Predation (<http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation>), and a third, Butterfly, from Railsback and Grimm (2012) <https://www.railsback-grimm-abm-book.com/>, all 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")'.

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

NetLogoR_1.0.5.9001.tar.gz
NetLogoR_1.0.5.9001.zip(r-4.5)NetLogoR_1.0.5.9001.zip(r-4.4)NetLogoR_1.0.5.9001.zip(r-4.3)
NetLogoR_1.0.5.9001.tgz(r-4.4-any)NetLogoR_1.0.5.9001.tgz(r-4.3-any)
NetLogoR_1.0.5.9001.tar.gz(r-4.5-noble)NetLogoR_1.0.5.9001.tar.gz(r-4.4-noble)
NetLogoR_1.0.5.9001.tgz(r-4.4-emscripten)NetLogoR_1.0.5.9001.tgz(r-4.3-emscripten)
NetLogoR.pdf |NetLogoR.html
NetLogoR/json (API)
NEWS

# Install 'NetLogoR' in R:
install.packages('NetLogoR', repos = c('https://predictiveecology.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/predictiveecology/netlogor/issues

On CRAN:

98 exports 37 stars 3.09 score 5 dependencies 294 downloads

Last updated 3 months agofrom:0b15e635f8 (on development)

Exports:agentMatrixbboxbbox<-bkcanMovecellFromPxcorPycorclearPatchescoordinatescreateOTurtlescreateTurtlescreateWorlddiediffusedownhilldxdyextentfacefdhatchhomeinConeinitializeinRadiusinspectisNLclasslayerNameslayoutCircleleftmaxNofmaxOneOfmaxPxcormaxPycorminNofminOneOfminPxcorminPycormoveToneighborsNLallNLanyNLcountNLdistNLsetNLwithNLworldIndexnOfnoPatchesnoTurtlesnrowofoneOfotherpatchpatchAheadpatchAtpatchDistDirpatchespatchHerepatchLeftpatchRightpatchSetpExistPxcorPycorFromCellrandomPxcorrandomPycorrandomXcorrandomXYcorrandomYcorraster2worldrightsetXYsf2turtlesshowsortOnspatRast2worldspdf2turtlessproutstackWorldssubHeadingstExisttowardsturtleturtles2sfturtles2spdfturtlesAtturtleSetturtlesOnturtlesOwnupdateListuphillwithMaxwithMinworld2rasterworld2spatRastworldHeightworldWidthwrap

Dependencies:data.tablefpComparequickPlotRcppterra

NetLogoR Dictionary

Rendered fromNLR-Dictionary.Rmdusingknitr::rmarkdownon Jun 25 2024.

Last update: 2021-06-10
Started: 2017-07-12

Programming Guide NetLogoR

Rendered fromProgrammingGuide.Rmdusingknitr::rmarkdownon Jun 25 2024.

Last update: 2023-07-06
Started: 2016-06-20

Readme and manuals

Help Manual

Help pageTopics
The 'NetLogoR' packageNetLogoR-package NetLogoR
'.bboxCoords' is a drop in replacement for 'raster::.bboxCoords'..bboxCoords
Extract or Replace Parts of an Object$,agentMatrix-method [ [,agentMatrix,logical,missing,ANY-method [,agentMatrix,missing,character,ANY-method [,agentMatrix,missing,missing,missing-method [,agentMatrix,missing,numeric,ANY-method [,agentMatrix,numeric,character,ANY-method [,agentMatrix,numeric,missing,ANY-method [,agentMatrix,numeric,numeric,ANY-method [,worldArray,missing,missing,ANY-method [,worldArray,numeric,numeric,ANY-method [,worldMatrix,missing,missing,ANY-method [,worldMatrix,numeric,numeric,ANY-method [<- [<-,agentMatrix,missing,character,character-method [<-,agentMatrix,missing,numeric,character-method [<-,agentMatrix,missing,numeric,numeric-method [<-,agentMatrix,numeric,character,character-method [<-,agentMatrix,numeric,character,data.frame-method [<-,agentMatrix,numeric,missing,numeric-method [<-,agentMatrix,numeric,numeric,character-method [<-,agentMatrix,numeric,numeric,numeric-method [<-,worldArray,missing,missing,matrix-method [<-,worldArray,numeric,numeric,matrix-method [<-,worldMatrix,missing,missing,ANY-method [<-,worldMatrix,numeric,numeric,ANY-method
Subsetting and replacing for 'worldArray' class$ $,worldArray-method [[,worldArray,ANY,missing-method [[<-,worldArray,ANY,missing-method
Relational Operators==,agentMatrix,character-method ==,agentMatrix,numeric-method
Create a new 'agentMatrix' objectagentMatrix agentMatrix,matrix-method agentMatrix,missing-method
The 'agentMatrix' classagentMatrix-class
Extract or set bounding boxbbox bbox,agentMatrix-method bbox,ANY-method bbox,SpatExtent-method bbox,worldNLR-method bbox<- bbox<-,agentMatrix,matrix-method
Move backwardbk bk,agentMatrix,numeric-method
Can the 'turtles' move?canMove canMove,worldNLR,agentMatrix,numeric-method
Combine R Objects by Rows or Columnscbind cbind.agentMatrix rbind rbind.agentMatrix
Cells numbers from 'patches' coordinatescellFromPxcorPycor cellFromPxcorPycor,worldNLR,numeric,numeric-method
Clear 'world''s 'patches'clearPatches clearPatches,worldArray-method clearPatches,worldMatrix-method
Spatial accessors and setters for NetLogoR classescoordinates,agentMatrix-method
Create ordered 'turtles'createOTurtles createOTurtles,numeric-method
Create 'turtles'createTurtles createTurtles,numeric,matrix,missing-method createTurtles,numeric,missing,ANY-method
Create a 'world'createWorld createWorld,missing,missing,missing,missing,missing-method createWorld,numeric,numeric,numeric,numeric,ANY-method
Kill 'turtles'die die,agentMatrix,numeric-method
Diffuse values in a 'world'diffuse diffuse,worldArray,character,numeric,numeric-method diffuse,worldMatrix,missing,numeric,numeric-method
Move downhilldownhill downhill,worldArray,character,agentMatrix,numeric-method downhill,worldMatrix,missing,agentMatrix,numeric-method
x-incrementdx dx,agentMatrix,missing-method dx,agentMatrix,numeric-method
y-incrementdy dy,agentMatrix,missing-method dy,agentMatrix,numeric-method
Bounding box and extent methods for NetLogoR classesextent,agentMatrix-method extent,worldNLR-method
Face somethingface face,agentMatrix,matrix-method
Move forwardfd fd,agentMatrix,numeric-method
Hatch new 'turtles'hatch hatch,agentMatrix,numeric,numeric-method
Return homehome home,worldNLR,agentMatrix,character-method
'Agents' in coneinCone inCone,agentMatrix,numeric,numeric,matrix-method
Initialize for 'agentMatrix' Classinitialize,agentMatrix-method
'Agents' in radiusinRadius inRadius,matrix,numeric,matrix-method
Inspect 'turtles'inspect inspect,agentMatrix,numeric-method
Type of objectisNLclass isNLclass,matrix,character-method
Layout 'turtles' on a circlelayoutCircle layoutCircle,worldNLR,agentMatrix,numeric-method
Rotate to the leftleft left,agentMatrix,numeric-method
'N' 'agents' with maximummaxNof maxNof,agentMatrix,numeric,missing,character-method maxNof,matrix,numeric,worldArray,character-method maxNof,matrix,numeric,worldMatrix,missing-method
One 'agent' with maximummaxOneOf maxOneOf,agentMatrix,missing,character-method maxOneOf,matrix,worldArray,character-method maxOneOf,matrix,worldMatrix,missing-method
Maximum 'pxcor'maxPxcor maxPxcor,worldNLR-method
Maximum 'pycor'maxPycor maxPycor,worldNLR-method
'N' 'agents' with minimumminNof minNof,agentMatrix,numeric,missing,character-method minNof,matrix,numeric,worldArray,character-method minNof,matrix,numeric,worldMatrix,missing-method
One 'agent' with minimumminOneOf minOneOf,agentMatrix,missing,character-method minOneOf,matrix,worldArray,character-method minOneOf,matrix,worldMatrix,missing-method
Minimum 'pxcor'minPxcor minPxcor,worldNLR-method
Minimum 'pycor'minPycor minPycor,worldNLR-method
Move tomoveTo moveTo,agentMatrix,matrix-method
Neighbors 'patches'neighbors neighbors,worldNLR,matrix,numeric-method
All agents?all NLall NLall,agentMatrix,missing,character-method NLall,matrix,worldArray,character-method NLall,matrix,worldMatrix,missing-method
Any agents?any NLany NLany,matrix-method
Count agentscount NLcount NLcount,matrix-method
Distances between agentsdist NLdist NLdist,matrix,matrix-method
Set an 'agents' variableNLset NLset,missing,agentMatrix,agentMatrix,character-method NLset,worldArray,missing,matrix,character-method NLset,worldMatrix,missing,matrix,missing-method set
'Agents' withNLwith NLwith,agentMatrix,missing,character-method NLwith,matrix,worldArray,character-method NLwith,matrix,worldMatrix,missing-method with
'WorldMatrix' indices from vector indicesNLworldIndex NLworldIndex,worldMatrix,numeric-method
N random 'agents'nOf nOf,matrix,numeric-method
No 'patches'noPatches
No 'turtles'noTurtles
Methods for 'quickPlot'.identifyGrobToPlot,worldArray,.quickPlotGrob-method layerNames,worldArray-method numLayers.worldArray numLayers.worldMatrix
Values of an 'agents' variableof of,missing,agentMatrix,character-method of,worldArray,matrix,character-method of,worldMatrix,matrix,missing-method
One random 'agent'oneOf oneOf,matrix-method
Othersother other,matrix,matrix-method
'Patches' coordinatespatch patch,worldNLR,numeric,numeric-method
'Patches' aheadpatchAhead patchAhead,worldNLR,agentMatrix,numeric-method
'Patches' atpatchAt patchAt,worldNLR,matrix,numeric,numeric-method
'Patches' at given distances and directionspatchDistDir patchDistDir,worldNLR,matrix,numeric,numeric-method
All the 'patches' in a 'world'patches patches,worldNLR-method
'Patches' herepatchHere patchHere,worldNLR,agentMatrix-method
'Patches' on the leftpatchLeft patchLeft,worldNLR,agentMatrix,numeric,numeric-method
'Patches' on the rightpatchRight patchRight,worldNLR,agentMatrix,numeric,numeric-method
'Patch' setpatchSet patchSet,matrix-method
Do the patches exist?pExist pExist,worldNLR,numeric,numeric-method
Basic plot methods for 'agentMatrix', 'worldMatrix', 'worldArray'plot.agentMatrix plot.worldArray plot.worldMatrix points.agentMatrix
'Patches' coordinates from cells numbersPxcorPycorFromCell PxcorPycorFromCell,worldNLR,numeric-method
Random 'pxcor'randomPxcor randomPxcor,worldNLR,numeric-method
Random 'pycor'randomPycor randomPycor,worldNLR,numeric-method
Random 'xcor'randomXcor randomXcor,worldNLR,numeric-method
Random 'turtles' coordinatesrandomXYcor randomXYcor,worldNLR,numeric-method
Random 'ycor'randomYcor randomYcor,worldNLR,numeric-method
Convert a Raster* object into a 'worldMatrix' or 'worldArray' objectraster2world raster2world,ANY-method
Rotate to the rightright right,agentMatrix,numeric-method
Set 'turtles'' locationssetXY setXY,agentMatrix,numeric,numeric,missing,ANY-method setXY,agentMatrix,numeric,numeric,worldNLR,logical-method
From 'sf' to 'agentMatrix'sf2turtles sf2turtles,ANY-method
Key base R functions for 'agentMatrix' classhead head.agentMatrix length,agentMatrix-method nrow,agentMatrix-method show,agentMatrix-method tail tail.agentMatrix
Key base R functions for 'worldNLR' classesshow,worldArray-method show,worldMatrix-method
Sort 'agents'sortOn sortOn,agentMatrix,missing,character-method sortOn,matrix,worldArray,character-method sortOn,matrix,worldMatrix,missing-method
Convert a 'SpatRaster' object into a 'worldMatrix' or 'worldArray' objectspatRast2world spatRast2world,SpatRaster-method
From 'SpatialPointsDataFrame' to 'agentMatrix'spdf2turtles spdf2turtles,ANY-method
Sprout new 'turtles'sprout sprout,numeric,matrix-method
Stack 'worlds'stackWorlds stackWorlds,worldMatrix-method
Subtract 'headings'subHeadings subHeadings,agentMatrix,agentMatrix-method subHeadings,agentMatrix,numeric-method subHeadings,numeric,agentMatrix-method subHeadings,numeric,numeric-method
Do the 'turtle' exist?tExist tExist,agentMatrix,numeric,character-method tExist,agentMatrix,numeric,missing-method
Directions towardstowards towards,matrix,matrix-method
Select 'turtles'turtle turtle,agentMatrix,numeric,character-method turtle,agentMatrix,numeric,missing-method
From 'agentMatrix' to 'sf'turtles2sf turtles2sf,ANY-method
From 'agentMatrix' to 'SpatialPointsDataFrame'turtles2spdf turtles2spdf,agentMatrix-method
'Turtles' atturtlesAt turtlesAt,worldNLR,agentMatrix,matrix,numeric,numeric,character-method turtlesAt,worldNLR,agentMatrix,matrix,numeric,numeric,missing-method
Create a 'turtle' 'agentset'turtleSet turtleSet,agentMatrix-method
'Turtles' onturtlesOn turtlesOn,worldNLR,agentMatrix,matrix,character-method turtlesOn,worldNLR,agentMatrix,matrix,missing-method
New 'turtles' variableturtlesOwn turtlesOwn,agentMatrix,character,ANY-method turtlesOwn,agentMatrix,character,missing-method
Update elements of a named list with elements of a second named listupdateList updateList,list,list-method updateList,list,NULL-method updateList,NULL,list-method updateList,NULL,NULL-method
Move uphilluphill uphill,worldArray,character,agentMatrix,numeric-method uphill,worldMatrix,missing,agentMatrix,numeric-method
'Agents' with maximumwithMax withMax,agentMatrix,missing,character-method withMax,matrix,worldArray,character-method withMax,matrix,worldMatrix,missing-method
'Agents' with minimumwithMin withMin,agentMatrix,missing,character-method withMin,matrix,worldArray,character-method withMin,matrix,worldMatrix,missing-method
Convert a 'worldMatrix' or 'worldArray' object into a Raster* objectworld2raster world2raster,worldArray-method world2raster,worldMatrix-method
Convert a 'worldMatrix' or 'worldArray' object into a 'SpatRaster' objectworld2spatRast world2spatRast,worldArray-method world2spatRast,worldMatrix-method
The 'worldArray' classworldArray worldArray-class
'World' heightworldHeight worldHeight,worldNLR-method
The 'worldMatrix' classworldMatrix worldMatrix-class
The 'worldNLR' classworldNLR worldNLR-class
'World' widthworldWidth worldWidth,worldNLR-method
Wrap coordinates or pixels in a torus-like fashionwrap wrap,ANY-method