Research Compendium of the project Spatial metrics calculation in the Biocom data set
Please cite this compendium as:
Sonia Kéfi and Alexandre Génin. Code associated with the paper ‘Dryland resilience to aridity is associated with self-organized vegetation patchiness’
This repository is structured as follow:
-
data/
: contains raw data required to perform analyses (model and real data) -
R/
: contains R functions allowing to prepare the data and calculate the spatial metrics in the model and in the data -
outputs/
: contains the results created during the workflow -
analyses/
: contains R scripts to plot the figures -
figures/
: contains the figures created during the workflow -
man/
: contains help files of R functions -
DESCRIPTION
: contains project metadata (author, date, dependencies, etc.) -
make.R
: main R script to run the entire project by calling each R script stored in theanalyses/
folder
Clone the repository, open spatialews_biocom.Rproj with R/Rstudio.
To calculate the spatial metrics from the the real images (that are in
outputs/data_biocom.rda
and outputs/data_biocom_200x200.rda
) and
from data generated by the model (that are in
data/aridvege_ca_runs.rds
for the model from Kéfi et al. 2007 and in
data/scanlon_ca_runs.rds
for the model from Scanlon et al. 2007), run:
source("make.R")
This generates result files that are saved in the folder outputs
. In
particular, biocom-grps.rda
contains information about the field
sites, indics-data50_Nperm_199_rev.rda
and
indics-data200_Nperm_199_rev.rda
contains a set of spatial metrics
measured on each of the real images (resp. for the 50 x 50 images and
for the subset of 200 x 200 images). The files
indics-kefimodel_all_Nperm_199_rev.rda
and
indics-scanlonmodel_Nperm_199_rev.rda
contain the same set of spatial
metrics measured on the images generated by the models of Kéfi et
al. (2007, Theoretical Population Biology) and Scanlon et al. (2007,
Nature). The files trends_model.rda
, trends_one_group.rda
,
trends_two_groups.rda
and trends_three_groups.rda
contain the trends
(i.e. slopes) of each of the spatial metrics along the stress gradient
(aridity in the data, parameter 1-b in the Kéfi model and parameter
1-fstar in Scanlon model).
Using these files, code available in the folder analyses
allows
performing additional analyses and plotting figures. The plot_fig.R
files allow generating the figures of the paper. The files
clustering_analyses.R
and compare_groups.R
perform additional
analyses.
- Required packages, listed in the
DESCRIPTION
file, will be installed (if necessary). - All required packages and R functions will be loaded.
- Some analyses listed in the
make.R
take time.