DOI: 10.6084/m9.figshare.28921001
title: Data and codes for manuscript: Environmental and functional niches complement phylogeny

description: <pre># scripts for Chapter 2<br><br># Environmental and functional niches complement phylogeny in explaining intraspecific <br># trait-environment response of woody plants<br><br>## =========================================================================#<br># 0. Data preprocess and analyzing ------------------------------------------<br>## =========================================================================#<br><br>## 0.1 Trait environmental data preprocess ------------------------------------<br>source('./src/0_Preparing/Species_name.R')<br>source('./src/0_Preparing/Trait_data_cleaning.R')<br>source('./src/0_Preparing/Trait_env_data_merge.R')<br><br>## 0.2 phylogenetic tree, trait plasticity and functional data calculation --------------<br>source('./src/0_Preparing/Download_phylogenetic_tree.R')<br>source('./src/0_Preparing/functional_niches.R')<br>source('./src/0_Preparing/habitat_niches.R')<br>source('./src/0_Preparing/spatial_distance.R')<br><br>## 0.3 Trait environment response estimates --------------<br>source('./src/0_Estimate_trait_environment_response/ITER_estimation_with_all_data.R')<br>source('./src/0_Preparing/combined_trait_response_with_drivers.R')<br>source('./src/0_Estimate_trait_environment_response/ITER_comparison_CHELSA_and_worldclimate.R')<br><br><br>## =========================================================================#<br># 1. Data overview ---------------------------------------------<br>## =========================================================================#<br><br>#* Global map of trait measurements<br>source('./src/1_global_map_and_trait_response/Global_map_data_preprocess.R')<br>source('./src/1_global_map_and_trait_response/Trait_response_along_gradients.R')<br>source('./src/1_global_map_and_trait_response/Trait_response_at_Order_and_family_level.R')<br><br>## =========================================================================#<br># 2. Phylogenetic constraints on ITERs across lineage scales --------------<br>## =========================================================================#<br># source('./src/2_phylgenetic_signal_along_linages/Lambda_at_different_level.R') # run once<br>source('./src/2_phylgenetic_signal_along_linages/Figure_brm_lambda_and_tree_plot.R')<br>source('./src/2_phylgenetic_signal_along_linages/Figure_of_all_lambda_in_sub_clades.R')<br><br>## =========================================================================#<br># 3. The effects of potential drivers on ITERs -------------------<br>## =========================================================================#<br>#* the effects of trait plasticity and functional niche under phylogenetic controls. <br>source('./src/3_Combined_analysis/Figure_main_driver_effects_brm.R')<br>source('./src/3_Combined_analysis/Relative_contribution_brm.R')<br>source('./src/3_Combined_analysis/summary_brm.R')<br><br><br>## =========================================================================#<br># 4. Supplementary: -------------------<br>## =========================================================================#<br>#* the effects of trait plasticity and functional niche under phylogenetic controls. <br># check the rhat and show the trace plot<br>source('./src/4_supplementary/rhat_and_trace_plot.R')<br>source('./src/4_supplementary/morans_I.R')<br>source('./src/4_supplementary/correlation_of_matrix.R')</pre>