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:
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')) |
Bug tracker:https://github.com/predictiveecology/netlogor/issues
Last updated 6 months agofrom:0b15e635f8 (on development). Checks:OK: 5 NOTE: 2. Indexed: yes.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Oct 23 2024 |
R-4.5-win | NOTE | Oct 23 2024 |
R-4.5-linux | NOTE | Oct 23 2024 |
R-4.4-win | OK | Oct 23 2024 |
R-4.4-mac | OK | Oct 23 2024 |
R-4.3-win | OK | Oct 23 2024 |
R-4.3-mac | OK | Oct 23 2024 |
Exports:agentMatrixbboxbbox<-bkcanMovecellFromPxcorPycorclearPatchescoordinatescreateOTurtlescreateTurtlescreateWorlddiediffusedownhilldxdyextentfacefdhatchhomeinConeinitializeinRadiusinspectisNLclasslayerNameslayoutCircleleftmaxNofmaxOneOfmaxPxcormaxPycorminNofminOneOfminPxcorminPycormoveToneighborsNLallNLanyNLcountNLdistNLsetNLwithNLworldIndexnOfnoPatchesnoTurtlesnrowofoneOfotherpatchpatchAheadpatchAtpatchDistDirpatchespatchHerepatchLeftpatchRightpatchSetpExistPxcorPycorFromCellrandomPxcorrandomPycorrandomXcorrandomXYcorrandomYcorraster2worldrightsetXYsf2turtlesshowsortOnspatRast2worldspdf2turtlessproutstackWorldssubHeadingstExisttowardsturtleturtles2sfturtles2spdfturtlesAtturtleSetturtlesOnturtlesOwnupdateListuphillwithMaxwithMinworld2rasterworld2spatRastworldHeightworldWidthwrap
Dependencies:data.tablefpComparequickPlotRcppterra
Readme and manuals
Help Manual
Help page | Topics |
---|---|
The 'NetLogoR' package | NetLogoR-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' object | agentMatrix agentMatrix,matrix-method agentMatrix,missing-method |
The 'agentMatrix' class | agentMatrix-class |
Extract or set bounding box | bbox bbox,agentMatrix-method bbox,ANY-method bbox,SpatExtent-method bbox,worldNLR-method bbox<- bbox<-,agentMatrix,matrix-method |
Move backward | bk bk,agentMatrix,numeric-method |
Can the 'turtles' move? | canMove canMove,worldNLR,agentMatrix,numeric-method |
Combine R Objects by Rows or Columns | cbind cbind.agentMatrix rbind rbind.agentMatrix |
Cells numbers from 'patches' coordinates | cellFromPxcorPycor cellFromPxcorPycor,worldNLR,numeric,numeric-method |
Clear 'world''s 'patches' | clearPatches clearPatches,worldArray-method clearPatches,worldMatrix-method |
Spatial accessors and setters for NetLogoR classes | coordinates,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 downhill | downhill downhill,worldArray,character,agentMatrix,numeric-method downhill,worldMatrix,missing,agentMatrix,numeric-method |
x-increment | dx dx,agentMatrix,missing-method dx,agentMatrix,numeric-method |
y-increment | dy dy,agentMatrix,missing-method dy,agentMatrix,numeric-method |
Bounding box and extent methods for NetLogoR classes | extent,agentMatrix-method extent,worldNLR-method |
Face something | face face,agentMatrix,matrix-method |
Move forward | fd fd,agentMatrix,numeric-method |
Hatch new 'turtles' | hatch hatch,agentMatrix,numeric,numeric-method |
Return home | home home,worldNLR,agentMatrix,character-method |
'Agents' in cone | inCone inCone,agentMatrix,numeric,numeric,matrix-method |
Initialize for 'agentMatrix' Class | initialize,agentMatrix-method |
'Agents' in radius | inRadius inRadius,matrix,numeric,matrix-method |
Inspect 'turtles' | inspect inspect,agentMatrix,numeric-method |
Type of object | isNLclass isNLclass,matrix,character-method |
Layout 'turtles' on a circle | layoutCircle layoutCircle,worldNLR,agentMatrix,numeric-method |
Rotate to the left | left left,agentMatrix,numeric-method |
'N' 'agents' with maximum | maxNof maxNof,agentMatrix,numeric,missing,character-method maxNof,matrix,numeric,worldArray,character-method maxNof,matrix,numeric,worldMatrix,missing-method |
One 'agent' with maximum | maxOneOf 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 minimum | minNof minNof,agentMatrix,numeric,missing,character-method minNof,matrix,numeric,worldArray,character-method minNof,matrix,numeric,worldMatrix,missing-method |
One 'agent' with minimum | minOneOf 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 to | moveTo 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 agents | count NLcount NLcount,matrix-method |
Distances between agents | dist NLdist NLdist,matrix,matrix-method |
Set an 'agents' variable | NLset NLset,missing,agentMatrix,agentMatrix,character-method NLset,worldArray,missing,matrix,character-method NLset,worldMatrix,missing,matrix,missing-method set |
'Agents' with | NLwith NLwith,agentMatrix,missing,character-method NLwith,matrix,worldArray,character-method NLwith,matrix,worldMatrix,missing-method with |
'WorldMatrix' indices from vector indices | NLworldIndex 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' variable | of of,missing,agentMatrix,character-method of,worldArray,matrix,character-method of,worldMatrix,matrix,missing-method |
One random 'agent' | oneOf oneOf,matrix-method |
Others | other other,matrix,matrix-method |
'Patches' coordinates | patch patch,worldNLR,numeric,numeric-method |
'Patches' ahead | patchAhead patchAhead,worldNLR,agentMatrix,numeric-method |
'Patches' at | patchAt patchAt,worldNLR,matrix,numeric,numeric-method |
'Patches' at given distances and directions | patchDistDir patchDistDir,worldNLR,matrix,numeric,numeric-method |
All the 'patches' in a 'world' | patches patches,worldNLR-method |
'Patches' here | patchHere patchHere,worldNLR,agentMatrix-method |
'Patches' on the left | patchLeft patchLeft,worldNLR,agentMatrix,numeric,numeric-method |
'Patches' on the right | patchRight patchRight,worldNLR,agentMatrix,numeric,numeric-method |
'Patch' set | patchSet 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 numbers | PxcorPycorFromCell 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' coordinates | randomXYcor randomXYcor,worldNLR,numeric-method |
Random 'ycor' | randomYcor randomYcor,worldNLR,numeric-method |
Convert a Raster* object into a 'worldMatrix' or 'worldArray' object | raster2world raster2world,ANY-method |
Rotate to the right | right right,agentMatrix,numeric-method |
Set 'turtles'' locations | setXY 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' class | head head.agentMatrix length,agentMatrix-method nrow,agentMatrix-method show,agentMatrix-method tail tail.agentMatrix |
Key base R functions for 'worldNLR' classes | show,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' object | spatRast2world 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 towards | towards 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' at | turtlesAt 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' on | turtlesOn turtlesOn,worldNLR,agentMatrix,matrix,character-method turtlesOn,worldNLR,agentMatrix,matrix,missing-method |
New 'turtles' variable | turtlesOwn turtlesOwn,agentMatrix,character,ANY-method turtlesOwn,agentMatrix,character,missing-method |
Update elements of a named list with elements of a second named list | updateList updateList,list,list-method updateList,list,NULL-method updateList,NULL,list-method updateList,NULL,NULL-method |
Move uphill | uphill uphill,worldArray,character,agentMatrix,numeric-method uphill,worldMatrix,missing,agentMatrix,numeric-method |
'Agents' with maximum | withMax withMax,agentMatrix,missing,character-method withMax,matrix,worldArray,character-method withMax,matrix,worldMatrix,missing-method |
'Agents' with minimum | withMin withMin,agentMatrix,missing,character-method withMin,matrix,worldArray,character-method withMin,matrix,worldMatrix,missing-method |
Convert a 'worldMatrix' or 'worldArray' object into a Raster* object | world2raster world2raster,worldArray-method world2raster,worldMatrix-method |
Convert a 'worldMatrix' or 'worldArray' object into a 'SpatRaster' object | world2spatRast world2spatRast,worldArray-method world2spatRast,worldMatrix-method |
The 'worldArray' class | worldArray worldArray-class |
'World' height | worldHeight worldHeight,worldNLR-method |
The 'worldMatrix' class | worldMatrix worldMatrix-class |
The 'worldNLR' class | worldNLR worldNLR-class |
'World' width | worldWidth worldWidth,worldNLR-method |
Wrap coordinates or pixels in a torus-like fashion | wrap wrap,ANY-method |