shift_positions: Shift a matrix of x- and y-coordinates in random directions

View source: R/shift_positions.R

shift_positionsR Documentation

Shift a matrix of x- and y-coordinates in random directions

Description

shift_positions peturbs the positions of a matrix of positions by distances drawn from an exponential distribution. Dispersal is simulated in a square habitat of width box_limit centred on x=y=0.

Usage

shift_positions(coords, mean_dispersal_distance, box_limit)

Arguments

coords

Matrix with a row for each individual and two rows.

mean_dispersal_distance

Float giving the average perturbation distance. The reciprocal of this value is used as a rate for the exponential distribution.

box_limit

Float >1 giving half the width of the habitat.

Details

Dispersal is in a box. If the simulated dispersal distance takes a seed beyond the boundary of the habitat it will be reflected back into the habitat. Note that if dispersal distances are much larger than the habitat size then it could be that the reflected distance goes beyond the other limit of the population.

Value

A matrix matching the shape of the input coords, but with values shifted by some exponential distance.


ellisztamas/simmiad documentation built on Dec. 12, 2023, 5:32 a.m.