envrules: Environmental rules.

Description Usage Arguments Details Value Author(s) Examples

View source: R/gol.R

Description

The extra environmental rules for the Game of Life.

Usage

1
envrules(lraster, env, mean=0, sd=1, alpha=0.05)

Arguments

lraster

A raster where living and dead cells are processed.

env

A raster object with exactly the same proprieties as lraster but with values defining the environmental setting. For instance, a climate raster.

mean

The mean value of a normal distribution defining the suitable values in relation to the env raster.

sd

The standard deviation of a normal distribution defining the suitable values in relation to the env raster.

alpha

Suitable values in the normal distribution are found within the interval (alpha, 1-alpha).

Details

This function accepts a raster with ones and zeros (alive and dead cells) and a second raster with same extent and resolution that has environmental information. Based on a normal distribution with 'mean' and 'sd', cells that are alive but on unsuitable areas are set to zero.

Value

A raster representing the alive/dead cells in the following generation.

Author(s)

Pedro Tarroso

Examples

1
2
3
4
5
6
7
8
	# not a particularly good example...
	require(raster)
	map <- raster(ncol=360, nrow=180)
	gen0 <- prepareGrid(map)
	env <- gen0*0 + rnorm(cells(gen0))
	gen1 <- liferules(lraster)
	gen1b <- envrules(gen1, env, mean=0, sd=0.5)
	plot(stack(gen0, env, gen1, gen1b))

ptarroso/gameR documentation built on Nov. 17, 2021, 12:33 a.m.