Skip to main content
Dryad logo

R code for: The joint evolution of learning and dispersal maintains intraspecific diversity in metapopulations

Citation

Liedtke, Jannis; Fromhage, Lutz (2021), R code for: The joint evolution of learning and dispersal maintains intraspecific diversity in metapopulations, Dryad, Dataset, https://doi.org/10.5061/dryad.qz612jmck

Abstract

To get a better understanding of the joint evolution of dispersal tendencies and of cognitive abilities, we built an individual-based simulation. Both learning speed and dispersal tendency were free to evolve. Results show that both positive and negative correlations could evolve between these traits, depending on properties both of local patches and of the metapopulation as a whole. Furthermore, we found that dispersal stabilized the co-existence of different cognitive types in the metapopulation, thereby helping to maintain biodiversity within species.

Here we provide the R code for the function with which the simulation for the study "The joint evolution of learning and dispersal maintains intraspecific diversity in metapopulations" has been conducted.

Description of the code is given as comments in the code itself.

Methods

The results are deriving from IMBs.  Description of the code is given as comments in the code itself.

Usage Notes

Datafiles ending with ~run* are .rds files. Here, for each of the patches within a metapopulation a table is given with one row for each individual. Columns are described in the R code of the simulation which is provided in file: “RCode_Dryad.R”.

Files can be loaded in R using e.g. : data<-readRDS("/Users/jannisliedtke/Desktop/ Neg_Correlation_Run1")

Files named “Tab_Summary_*” are summary tables in .csv format which provided summary statistics (e.g. mean values and std.err. of traits) of metapopulations.

Files can be loaded in R using e.g. : data<-read.csv("/Users/jannisliedtke/Desktop/ Neg_Correlation_Run1")

Funding

Deutsche Forschungsgemeinschaft, Award: 394327820