1_Traits.zip:
Speciation correlations paper - trait data.R
	- Takes raw landmark data from 3D scans of Charadriiformes beaks
	- Outputs PC scores of aligned landmarks in beak morphospace (I.e. beak shape only) and formspace (beak size and shape)
	- Also outputs beak centroid size, log body mass, and relative bill size

Input data files:
Charadriiformes_all_landmarks.rds
landpairs.txt
bodymass.csv - Body mass data taken from Wilman H, Belmaker J, Simpson J, de la Rosa C, Rivadeneira MM, Jetz W. 2014 EltonTraits 1.0: species-level foraging attributes of the world’s birds and mammals. Ecology 95, 2027–2027. (doi:10.1890/13-1917.1)

Output data files:
PC_scores_Morphospace.csv - PC scores from bill morphospace (shape only)
PC_scores_Formspace.csv - PC scores from bill formspace (shapeand size)
cslog.csv - beak centroid size 
Relative_bill_size.csv - relative beak size (centroid size / log body size)
logbody.csv

2_Phylogeny.zip: 
Speciation correlations paper - phylogeny.R 
	- Takes as input a distribution of trees from Birdtree.org.
	- Converts file format to newick (not strictly necessary but code is as run)
	- Generates maximum clade credibility (MCC) tree and stores in newick and nexus format
	- Subsets and outputs MCC trees for different traits
	- Rescales and output MCC trees by estimating Pagel’s lambda for different traits

Input data files:
output.nex - distribution of 1000 Charadriiformes phylogenies from bird tree.org in nexus format
logbody.csv - log transformed body size data
PC_scores_Formspace.csv - PCs 1-3 for formspace (bill size & shape)
PC_scores_Morphospace.csv - PCs 1-7 for morphospace (bill shape)
Relative_bill_size.csv - bill centroid size / body size

Output data files:
mcc_all.nex & mcc_all.tre - MCC tree containing all species
mcc_formspace.nex & mcc_formspace.tre - MCC tree containing all species with bill data
mcc_bodysize.nex & mcc_bodysize.tre - MCC tree containing all species with body size data
mcc_relbill.nex & mcc_relbill.tre - MCC tree containing all species with bill and body size data

rescaled_formspace.nex - newick format MCC tree rescaled according to lambda estimate for first 3 PCs of formspace (beak size and shape) 
rescaled_bodysize.nex- newick format MCC tree rescaled according to lambda estimate for log body size
rescaled_morphospace.nex - newick format MCC tree rescaled according to lambda estimate for first 7 PCs of morphospace (beak shape) 
rescaled_relbill.nex -  newick format MCC tree rescaled according to lambda estimate for relative bill size

suborders.csv - file with details of species assignment to Charadriiformes suborders.

3_Clads_rates.zip
Speciation correlation paper - clads controls.txt
Speciation correlation paper - Clads results.R
	- clads controls runs CLaDS analysis using the MCC tree
	- Clads results processes CLaDs output to generate per ranch rate estimates for downstream analysis
	- Also includes code to plot phylogeny with per branch rates (Figure 2)

Input data files:
mcc_all.tre - MCC tree containing all species (used in Figure 2)
mcc_relbill.tre - MCC tree containing all species with bill and body size data
mcc_bodysize.tre - MCC tree containing all species with body size data
mcc_formspace.tre - MCC tree containing all species with bill data

Output data files:
clads_output.rds - clads output for tree containing all species
ShorebirdBillBodytree_clads.rds - clads output for tree containing all species with bill and body size data
ShorebirdBilltree_clads.rds - clads output for tree containing all species with bill data
ShorebirdBodytree_clads.rds - clads output for tree containing all species with body size data

tipsprates.csv - Average per branch speciation rates for tips only
wholecrates.csv - Average per branch speciation rates for all branches
Bodycrates.csv - Average per branch speciation rates for all branches for tree pruned to include only species with body size data
Bodycrates_tip.csv - Average per branch speciation rates for tips only for tree pruned to include only species with body size data
Billcrates.csv - Average per branch speciation rates for all branches for tree pruned to include only species with bill data
Billcrates_tip.csv - Average per branch speciation rates for tips only for tree pruned to include only species with bill data
BillBodycrates.csv - Average per branch speciation rates for all branches for tree pruned to include only species with bill and body size data
BillBodycrates_tip.csv - Average per branch speciation rates for tips only for tree pruned to include only species with bill and body size data

4_TraitRates.zip
Speciation correlation paper - bayestraits controls.txt
Speciation correlation paper - BayesTraits results.R
	- BayesTraits controls runs BayesTraits on each of the four trait data sets (note phylogenies are nexus format and data are tab delimited text with column names)
	- BayesTraits results process output from BayesTraits to produce files with per branch rates for all branches and tips only

Input data files:
rescaled_formspace.nex - newick format MCC tree rescaled according to lambda estimate for first 3 PCs of formspace (beak size and shape) 
rescaled_bodysize.nex- newick format MCC tree rescaled according to lambda estimate for log body size
rescaled_morphospace.nex - newick format MCC tree rescaled according to lambda estimate for first 7 PCs of morphospace (beak shape) 
rescaled_relbill.nex -  newick format MCC tree rescaled according to lambda estimate for relative bill size

logbody.csv - log transformed body size data
PC_scores_Formspace.csv - PCs 1-3 for formspace (bill size & shape)
PC_scores_Morphospace.csv - PCs 1-7 for morphospace (bill shape)
Relative_bill_size.csv - bill centroid size / body size

Output data files:
form1results_formatted.txt - Bayestraits output for formspace
morphresults_formatted.txt - Bayestraits output for morphospace
logbodyresults_formatted.txt - Bayestraits output for body size
billoverbodyresults2_formatted.txt - Bayestraits output for relative bill size

brates_body_tiprates.csv - Average per branch body size rates for tips only
brates_body.csv - Average per branch body size rates for all branches
brates_form_tiprates.csv - Average per branch formspace rates for tips only
brates_form.csv - Average per branch formspace rates for all branches
brates_morph_tiprates.csv - Average per branch morphospace rates for tips only
brates_morph.csv - Average per branch morphospace rates for all branches
brates_relbill_tiprates.csv - Average per branch relative bill size rates for tips only
brates_relbill.csv - Average per branch relative bill size rates for all branches

5_Cor-strates.zip
Fit_corstrates_shorebirds.R
	- Fits corstrates models for each combination of speciation rates and trait evolution rates
	- Generates null distribution of expected Spearman rank correlations between speciation and trait rates for comparison with observed rates
	- Analyses for full tree and for three major clades (Lari, Charadrii, Scolopaci)
	- Note that code assigns output to four named, empty folders (bodysize_corstrates, formspace_corstrates, morphospace_corstrates, relbill_corstrates)

Input data files:
logbody.csv - log transformed body size data
PC_scores_Morphospace.csv - PC scores from bill morphospace (shape only)
PC_scores_Formspace.csv - PC scores from bill formspace (shapeand size)
Relative_bill_size.csv - bill centroid size / body size

rescaled_formspace.nex - newick format MCC tree rescaled according to lambda estimate for first 3 PCs of formspace (beak size and shape) 
rescaled_bodysize.nex- newick format MCC tree rescaled according to lambda estimate for log body size
rescaled_morphospace.nex - newick format MCC tree rescaled according to lambda estimate for first 7 PCs of morphospace (beak shape) 
rescaled_relbill.nex -  newick format MCC tree rescaled according to lambda estimate for relative bill size

brates_body_tiprates.csv - Average per branch body size rates for tips only
brates_form_tiprates.csv - Average per branch formspace rates for tips only
brates_morph_tiprates.csv - Average per branch morphospace rates for tips only
brates_relbill_tiprates.csv - Average per branch relative bill size rates for tips only

BillBodycrates_tip.csv - Average per branch speciation rates for tips only for tree pruned to include only species with bill and body size data
Billcrates_tip.csv - Average per branch speciation rates for tips only for tree pruned to include only species with bill data
Bodycrates.csv - Average per branch speciation rates for all branches for tree pruned to include only species with body size data

suborders.csv - file with details of species assignment to Charadriiformes suborders.

Output data files:

Res_null_correlation_coefs_Charadrii.csv - 200 null correlation coefficients relating each trait rate to speciation rates for the suborder Charadrii
Res_null_correlation_coefs_Lari.csv  - 200 null correlation coefficients relating each trait rate to speciation rates for the suborder Lari
Res_null_correlation_coefs_Scolopaci.csv - 200 null correlation coefficients relating each trait rate to speciation rates for the suborder Scolopaci
Res_null_correlation_coefs.csv - 200 null correlation coefficients relating each trait rate to speciation rates for entire order

Res_table_by_suborder.csv - summary table for suborders showing observed correlation, significance, mean and confidence interval for the null, and the effect size of the correlation
Res_table.csv - summary table for entire order showing observed correlation, significance, mean and confidence interval for the null, and the effect size of the correlation