View source: R/Parameter_functions.R
set_mig | R Documentation |
Function to create list of migration matrices.
set_mig(paramfile, site.arrange, max.dist, tot)
paramfile |
params object initialized using |
site.arrange |
Matrix or Distance object. Either a two column matrix with x-values \(i.e. longitude\) in the first column and y-values (i.e. latitude) in the second column or a pairwise distance object between each site. |
max.dist |
Numeric vector containing the maximum distance species can migrate. |
tot |
Numeric vector containing values between 0 and 1 of the probability for a species to migrate. |
The parameters max.dist and tot can be either single values or vectors. If a single value the code assumes that each species has the same migration matrix, if a vector, it creates separate migration matrices for each species according to the inputed parameters. Species specific parameters for max.dist and tot must be in the same order as in the metacommunity matrix.
Returns a list of numeric migration matrices.
make_mig
paramfile <- make_params(5,5)
# Make random landscape with 5 sites
xy <- matrix(sample(50, 10), ncol = 2)
## Where all species have the same migration matrix ##
paramfile$mig <- set_mig(paramfile, xy, 10, .1)
## Where each species has own migration matrix
paramfile$mig <- set_mig(paramfile, xy, c(10, 9, 15, 2, 11), c(.1, .2, .05, .1, .15))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.