RIP: RIP

Description Usage Arguments Value Author(s) Examples

Description

Three types of bacteria live in a petri dish. R has the highest reproduction rate followed by I and P. I is immune against the poison produced by P.

Usage

1
RIP(n=100, timesteps=50, sleep=0.1, col=c("blue", "yellow", "red"), image=TRUE) 

Arguments

n

Grid size

timesteps

Number of iterations

sleep

Argument for function Sys.sleep()

col

Color vector

image

Plot image during simulation TRUE/FALSE

Value

List of matrices with three species coded with 1, 2 and 3.

1 | R, high reproduction

2 | I, immune against poisson, but lower reproduction than R

3 | P, poissoness species, but less reposduction than the other two

Author(s)

Klara Dolos

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
mycols <- c("blue", "yellow", "red")

### Simulate and plot
RIP(n=100, timesteps=50, sleep=0.1, col=mycols, image=TRUE) 

### Save grids for later
res <- RIP(n=100, timesteps=100, sleep=0, col=mycols, image=FALSE) 

### Plot Population size over time
pops <- do.call(rbind, lapply(res, function(m) c(sum(m[]==1), sum(m[]==2), sum(m[]==3))))
matplot(1:length(res), pops, type="l", col=mycols, lwd=2, xlab="Zeitschritte", ylab="Populationsgröße")

# saveGIF(RIP(n=100, timesteps=100, sleep=0, col=mycols, image=TRUE) , movie.name = "animation.gif", img.name = "Rplot", convert = "convert",  interval = 0.6)
# file.copy("/tmp/RtmpVqjsL1/animation.gif", ".../rip4.gif")

KIT-IfGG/pets documentation built on May 28, 2019, 12:56 p.m.