Forager-class: Forager Constructor

Forager-classR Documentation

Forager Constructor

Description

Constructor function for Forager class objects. Objects of this class have methods for finding targets, moving, and plotting. Movement switches between brownian motion (with step lengths drawn from a gamme distribution) and directed toward a target

Fields

name

a character

location

a simple features collection with a single POINT class object

bearing

a numeric that gives the current bearing in radians. Default starting bearing is drawn from random uniform circular distribution

speed

a numeric value that gives the scale parameter of the gamma distribution from which step lengths are draw. Because the shape parameter of this distribution is set to 1, the speed variable will equal the average step length

sight

a numeric giving the distance at which the forager object can detect patches when in an environment

path

a simple features collection with a single multipoint object containing previous locations of the forager. Usually objects are created with default multipoint objects containing only the initial location

visitSeq

a character vector with the names (in order) of all patches visited. Must start with NAs equal in number to to the repeatAvoid variable (this is done by default if no value is given)

targeting

a logical giving which mode of movement the forager is in. Initial value usually uses default "FALSE"

repeatAvoid

numeric giving the number of different patches a forager must visit before targeting a recently visited patch again

target

a simple feature data frame with a single row containing the target patch location and values

Methods

move(bounds = NA)

moves the forager using rules given in class description. Updates relevant fields including location, bearing, visitSeq, bearing, targetting, and path

plot()

plots the location and path of the forager

setTarget(patches)

checks if the location of any simple features in the geometry column of the patches argument (class sfc) are within sight range. If so, sets target to a patch randomly selected from those within sight and then sets the targetting field to TRUE

tSelect(choices)

calculates probablilites and selects a target from a list of options but DOES NOT set the target (use setTarget for this, which calls tSelect).


aqvining/Foraging-Simulator documentation built on Nov. 19, 2022, 5:43 p.m.