Learn R Programming

BacArena (version 1.0.1)

move: 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)
"move"(object, pos, n, m, j)

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.

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

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

Run the code above in your browser using DataLab