Elasmobranch functional diversity is highly vulnerable and supported by unique species and locations worldwide
Catalina Pimiento, Camille Albouy, Daniele Silvestro, Theophile Mouton, Laure Velez, David Mouillot, Aaron B. Judah, John N. Griffin, Fabien Leprieur
This folder contains R code, data and outputs for all analyses in this paper. There are 4 main folders: functional diversity analyses, phylogenetic analysis, congruence mapping and MPAs.
The required packages for the functional diversity analyses are: tidyverse
, dplyr
, tidyr
, readxl
,stringr
, purrr
, readxl
, tidyselect
, data.table
, reshape2
and janitor
for data handling and manipulation; ade4
,geometry
,raster
,missForest
,mFD
and vegan
for analyses; and cowplot
, grid
, visreg
, ggcorrplot
,wesanderson
,gghighligh
and RColorBrewer
for plotting.
These can be downloaded and installed using the following commands:
install.packages("data.table")
install.packages("dplyr")
install.packages("tidyr")
install.packages("reshape2")
install.packages("ade4")
install.packages("geometry")
install.packages("readxl")
install.packages("stringr")
install.packages("tidyverse")
install.packages("janitor")
install.packages("rredlist")
install.packages("purrr")
install.package("raster")
install.package("missForest")
install.package("ggcorrplot")
install.package("cowplot")
install.package("beepr")
install.package("rgdal")
install.package("tidyselect")
install.package("mFD")
install.package("vegan")
install.package("cowplot")
install.package("grid")
install.package("visreg")
install.package("ggcorrplot")
install.package("wesanderson")
install.package("gghighlight")
install.package("RColorBrewer)"
install.package("wesanderson")
The scripts are as follows
- Fix_Synonyms.R: Identifies discrepancies in species names due to synonyms between distribution data (downloaded from IUCN) and trait data. Produces:
- iucn.names_traits.names.RData
- Update_iucn.R: Connects to IUCN API and gathers IUCN status. Produces:
- iucn_cat_syn.names.csv (dataframe with trait and IUCN names and their updated status)
- species_updated.iucn_no.syn.csv (trait names and updated IUCN)
- Regions_Ouccurrences.R: Transform gridded data (from 0 above) into occurrences to then calculate per-species geographic range. Produces:
- grids_biomes_no.syn.RData
- all_species_regions.csv
- all_species_range.csv
- Data.prep.imputations.R: It prepares the data for multiple imputations and transform taxonomy into one-hot-ecoding. Produces:
- shark.traits.imputations_all2.csv
- Imputations.R: Performs multiple imputations using one-hot-encoding and calculates error. Produces:
- shark_diet_imputations_1.rda
- shark_iucn_imputations_1.rda
- shark_imputations_1.rda
- Gather_impu_mode.R: Checks proportion of missing data per trait, computes modal value across imputations and correlations between inferred values across imputations. Produces:
- imp.mode.RData
- imp.all.RData
- FD-Analyses.Rmd: Performs all functional diversity analyses and produces all figures and tables cited in the paper. It requires the following functions:
- quality_funct_space_fromdist.R
- fonction_FRIC_Global_full.R
- get_indicator_function 2.R
- The phylo_analysis folder is related to all the analyses and data for quantifying species and assemblage-level phylogenetic metrics.
It produces 2 objects used in FD-Analyses.Rmd
- Res_HED_sharks.rds
- Res_HEDGE_sharks.rds
- The congruence_mapping folder includes all the analyses made to identify and map the hotspots and to quantify the congruence among metrics (including fishing pressure).
- The MPA_analysis folder includes all the information to quantify and map MPAs