DOI: 10.6084/m9.figshare.3553002
title: Supplement 1. R script files to calculate trait expansion and dispersion patterns, a community composition matrix input file, and a species traits input file for both R scripts.

description: File List calculate_trait_expansion.txt (md5: 782a2b4e8932e0f23d552842353a83e4) calculate_trait_dispersion.txt (md5: 6e8583fc1e2a7e4bfb769ce5d086644c) community_matrix.txt (md5: d1cb3bc29708eb8706e7f839c0d443f9) species_traits.txt (md5: 161dad8dfe6255412cb41f944d377caa) Description calculate_trait_expansion.txt The calculate_trait_expansion.txt file is an R script file. Save it as ‘filename’-dot-r, with trait_expansion_script as the recommended filename. Summarizing, the script performs the following actions: Input files for community composition (community_matrix.txt) and species trait values (species_traits.txt) are read. For each community from the ‘community_matrix.txt’ file, the observed trait range of present species is calculated Species are resampled over communities (with an <i>x</i> number of permutations), while keeping observed frequency and richness patterns fixed, and randomized trait ranges are calculated for each community The difference between observed and expected trait ranges (ReTR = residual trait range) is calculated. An overall test whether ReTRs differ significantly from 0 All ReTR values are written in an output text file Calculate_trait_dispersion.txt The calculate_trait_dispersion.txt file is an R script file. Save it as ‘filename’-dot-r, with trait_dispersion_script as the recommended filename. Summarizing, the script performs the following actions: Input files for community composition (community_matrix.txt) and species trait values (species_traits.txt) are read. For each community from the ‘community_matrix.txt’ file, the observed trait distance evenness of present species is calculated Species are resampled over communities (with an <i>x</i> number of permutations), while keeping observed trait range, frequency and richness patterns fixed, and randomized trait distance evenness values are calculated for each community The difference between observed and expected trait distance evenness (ReTE = residual trait evenness) is calculated. An overall test whether ReTE differ significantly from 0 All ReTE values are written in an output text file community_matrix.txt The community_matrix.txt file is a tab-separated file. It contains a fictional community composition data set that can be used as an example input file for the calculate_trait_expansion.txt and calculate_trait_dispersion.txt files. Column definitions Plotname # the name of a plot or local community Species 1 # abundances/presences of species nr. 1 Species 2 # abundances/presences of species nr. 2 Species 3 # abundances/presences of species nr. 3 Species 4 # abundances/presences of species nr. 4 Species 5 # abundances/presences of species nr. 5 Species 6 # abundances/presences of species nr. 6 Species 7 # abundances/presences of species nr. 7 Species 8 # abundances/presences of species nr. 8 species_traits.txt The species_traits.txt file is a tab-separated file. It contains a fictional species traits data set that can be used as an example input file for the calculate_trait_expansion.txt and calculate_trait_dispersion.txt files. Column definitions Species # the name of the species Trait 1 # the value of trait 1 Trait 2 # the value of trait 2 Trait 3 # the value of trait 3 Trait 4 # the value of trait 4