The R_Code.7z file contains all files as well as R scripts and objects necessary to replicate the analytical workflow described in the manuscript.

000_functions.R — Functions
All core functions are stored in a centralized R script named 000_functions.R.
Users must load this script using the source() function in R prior to running any analysis (similar to loading a package).
Detailed function descriptions and usage instructions are included within the script.


grids — Spatial grids
This folder includes spatial grid files used to assign species occurrences. Different taxa are associated with distinct grid resolutions:
grid_1: Terrestrial animals (Amphibians, Birds, Dragonflies, Mammals, Reptiles)
grid_4: Marine animals (Rays)
grid_05: Terrestrial plants (Trees)

00_Link_Taxon — Species occurrences
These files encode species presence within grid cells following Infomap-compatible node naming conventions.
They are essential input for linking spatial data with Infomap outputs in downstream biodiversity analyses.

01_Infomap_Taxon.tree — Infomap output
These are the output files generated by Infomap in .tree format.
They provide hierarchical module assignments for each node (grid cell or species) and are used alongside 00_Link_Taxon files to compute biodiversity metrics.

02_Calculate_Metric.R — Biodiversity metrics
This script demonstrates how to compute four biodiversity metrics using the Infomap output and species-grid associations. It includes a worked example for amphibians.
Due to the heuristic nature of k-means clustering, we provide pre-computed outputs to facilitate result replication.
The outputs are stored in seven .rds files, one for each taxon:
02_Op_db_clust_Taxo_Amph.rds
02_Op_db_clust_Taxo_Mamm.rds
02_Op_db_clust_Taxo_Bird.rds
02_Op_db_clust_Taxo_Drag.rds
02_Op_db_clust_Taxo_Rept.rds
02_Op_db_clust_Taxo_Tree.rds
02_Op_db_clust_Taxo_Rays.rds

03_Analyses.R — General biogeographical sectors
This script performs the core analyses to identify general biogeographical sectors using weighted k-means clustering.

031a_Op_Weight_Clust_X.rds — Weighted k-means output
These files store the results of weighted k-means clustering across all taxa, based on the four biodiversity metrics.
The numeric suffix (e.g., X) denotes the number of clusters used.
Due to the heuristic and computational nature of the analysis, we provide the final clustering results as used in the manuscript.

031a_Op_Weight_Clust_equal_tax_X.rds
Similar outputs are provided here, considering the variable number of grid cells across taxa (refer to sensitivity analyses in the main text).

