move {BacArena}R Documentation

Function for random movement of organisms

Description

The generic function move implements a random movement in the Moore neighbourhood of an individual.

Usage

move(object, pos, n, m, j, occupyM)

## S4 method for signature 'Organism'
move(object, pos, n, m, j, occupyM)

Arguments

object

An object of class Organism.

pos

A dataframe with all occupied x and y positions

n

A number giving the horizontal size of the environment.

m

A number giving the vertical size of the environment.

j

The number of the iteration of interest.

occupyM

A matrix indicating grid cells that are obstacles

Details

Organisms move in a random position the Moore neighbourhood, which is not occupied by other individuals. If there is no free space the individuals stays in the same position.

See Also

Organism-class, emptyHood

Examples

data(Ec_core, envir = environment()) #get Escherichia coli core metabolic model
bac <- Bac(Ec_core,deathrate=0.05,
           minweight=0.05,growtype="exponential") #initialize a bacterium
arena <- Arena(n=20,m=20) #initialize the environment
arena <- addOrg(arena,bac,amount=10) #add 10 organisms
arena <- addSubs(arena,40) #add all possible substances
move(bac,n=20,m=20,j=1,pos=arena@orgdat[,c('x','y')], occupyM=arena@occupyM)

[Package BacArena version 1.8.2 Index]