DOI: 10.5061/dryad.1zcrjdg64
title: Data from: Allometric constraints and the modulation of weapon evolution by mating system in fiddler crabs

description: Sexual selection potentially drives the evolution of exaggerated traits
 used in intrasexual contests. However, the extent of mating systems’
 influence on weapon morphology remains unclear. In fiddler crab males, an
 exaggerated claw functions both as a weapon and a signaling tool, varying
 according to the species’ mating system. We examined claw evolution in
 male fiddler crabs, differentiating between two main mating strategies: 1.
 males defend their mating burrows (= ‘burrow’); 2. males do not mate in
 their own burrows (= ‘surface’). We measured claw morphological traits and
 tested whether the mating system affects their evolutionary rates,
 expecting ‘burrow’ species to exhibit higher evolutionary rates. In
 general, claw size scales isometrically with body size across species.
 Both systems showed no correlation between claw elements and mechanical
 advantage, indicating the necessity of maintaining a conspicuous signaling
 tool alongside an efficient lever system for grip strength as body size
 increases. Contrary to predictions, however, ‘burrow’ males exhibited
 lower evolutionary rates in claw traits than ‘surface’ males, suggesting
 stronger stabilizing selection. These findings highlight the nuanced
 effects of sexual selection on male fiddler crab weapon evolution,
 suggesting that mating systems can modulate evolutionary trajectories, yet
 functional demands for dual weapon-signal roles constrain claw morphology.
description: # Allometric constraint and the modulation of weapon evolution by mating
 system in fiddler crabs This readme has been divided in three parts.
 First, we will talk about the file structure, then the code, and the
 dataset. ##### File structure: We have two zip files: "code.zip"
 and "data.zip". The "code" zipped folder contains the
 code used to generate the data. The "data" zipped folder
 contains all the data required to run our analyses. Inside, you will find
 the datasets in ".csv", ".rds" files required for
 bootstrap analyses (see below), and ".nex" files that contain
 the phylogenetic trees. We have not included a folder for
 "figures" because these will be generated along with the code.
 If you want to visualize the figures without running the code, check the
 knitted HTML (*Fiddler-claw-evol.html*) file we are also uploading. #####
 Code: There are two codes: "RateMatrixFunctions.R" and
 "fiddler_crab_analyses.R". * *RateMatrixFunctions.R* - This code
 was taken from a Slater & Friscia (2019, see reference at the end) to
 run the Ovaskainen test. It is called right at the beginning of the code
 because it provides ancillary functions not yet implemented in the
 *ratematrix* package. * *fiddler_crab_analyses.R* - Here you will find the
 code we used. There are multiple analyses with different formats, but it
 is all explained within the code and the knitted Rmarkdown that comes
 along. ##### Dataset: We are uploading two data sets. One contains the
 data with all species - called "*medidas_full.csv*". The second
 data set is named "*def_linear_01-08-25.csv*". The main
 difference is that "*medidas_full.csv*" has all species, while
 the other data set contains only the species we are able to classify in
 either burrow or surface mating systems. The other two files,
 "*mating_short_all_spp.csv*" and
 "*def_mating_short.csv*", only contain a column with the species
 and another column with the mating systems. I know this could all be done
 in the same data frame, but I only learned to do that after I started the
 analyses. So, it's legacy data, but still used. We thus used all
 files for analyses. The dataset containing all species was used for
 ancestral reconstructions (as explained in the rmarkdown and our code),
 while the other dataset was used for the remainder of the analyses. Each
 row of both files is an individual. Thus, we used the averages (or
 standard deviation) for the analyses. "NA" cells represent
 individuals that we could not reliably estimate the measure. For instance,
 individuals that did not have a tubercle are listed as NA in that column.
 We are uploading two phylogenetic trees. The file named
 "*combined_50_burn_MCC_3.nex*" is the output containing all
 species for which genetic data exists. We used this file to run the
 ancestral reconstruction analyses, where we included the species for which
 we did not have information. The other phylogenetic tree, called
 "*Fiddler_complete.nex*", is the phylogenetic tree containing
 only the species for which we have data for. Thus, it is a pruned version
 of the other tree.  The ".rds" files contain the analyses ran
 with bootstrap to calculate confidence intervals. It is simply used to
 speed up the process. There are three types of analyses: 1- Allometry
 analyses, where some measure of claw size was regressed against the
 dependent variable and mating system. These files are all named
 "clawX_MODEL.rds", where X is a number indicating which variable
 was used, and MODEL indicated the evolutionary model used (Brownian Motion
 - BM, OUf - Ornstein Uhlenbeck with fixed root, OUr - Ornstein Uhlenbeck
 with random root, as described in the* phylolm* package documentation). 2-
 Proportional analyses, this is a single analysis run with proportional
 claw size (claw size/body size) against the mating system. Also uses the
 MODEL terminology from above. 3- Standard deviation analyses, where we
 regressed the standard deviation of a claw variable (e.g., mechanical
 advantage, length) * *against the mating system. The files were named
 similarly to the allometry analyses with "sdX_MODEL.rds", where
 X is the number indicating which claw variable was used, and MODEL
 indicates the evolutionary model used. METADATA OF def_linear_01-08-25.csv
 In the columns, we have the variables, in rows we have the individuals.
 Empty cells (NA) denote individuals that did not show the morphology being
 measured. COLUMN A: sp - the species. COLUMN B: ind - the name of the file
 we measured with the number of the individual. COLUMN C: carapace - the
 width of the carapace. Measured as the distance between the widest portion
 of the carapace. Unit: cm. COLUMN D: claw_size - the length of the claw.
 Measured from the joint between the propodus and the carpus to the distal
 point of the propodus. Unit: cm COLUMN E: tip_adv - Mechanical advantage
 for the tip of the dactyl (out.lever2). A division between in.lever and
 out.lever2. Unitless. COLUMN F: tub_adv - Mechanical advantage for the
 tubercle of the dactyl (out.lever). A division between in.lever and
 out.lever. Unitless. COLUMN G: mating - the mating system the species was
 classified as. Either 'burrow' or 'surface'. COLUMN H:
 manus - the distance between the joint of the propodus with the carpus to
 a linear projection of the base of the dactyl joint. This is a linear
 distance, so the projection forms a perpendicular line with the measure.
 Unit: cm. COLUMN I: in.lever - distance between where the apodeme attached
 on the dactyl to the fulcrum. Unit: cm. COLUMN K: out.lever1 - distance
 between the fulcrum and the tubercle. Unit: cm. COLUMN L: out.lever1 -
 distance between the fulcrum and the tip of the dactyl. Unit: cm. METADATA
 OF mating_short_all_spp.csv We used this file to calculate the likely
 states of species we categorized as a "mixed" mating system. To
 do so, lines and the first column (A) are species. The second column (B)
 contains whether a species is categorized as burrow mating system (1) or
 not (0); species that are labeled as 0.5 are mixed species. The third
 column (C) contains whether a species is categorized as surface mating
 system (1) or not (0); species with 0.5 are categorized as mixed mating
 system. ##### References Slater, G. J., & Friscia, A. R. (2019).
 Hierarchy in adaptive radiation: a case study using the Carnivora
 (Mammalia). Evolution, 73(3), 524-539. ##### Packages The code was run in
 R software v4.5.1. Packages used: * scatterplot3d(v.0.3-44) *
 pander(v.0.6.6) * sp(v.2.2-0) * RColorBrewer(v.1.1-3) *
 latticeExtra(v.0.6-30) * lattice(v.0.22-7) * corncob(v.0.4.2) *
 performance(v.0.15.0) * scales(v.1.4.0) * viridis(v.0.6.5) *
 viridisLite(v.0.4.2) * ratematrix(v.1.2.4) * phylolm(v.2.6.5) *
 ellipse(v.0.5.0) * vioplot(v.0.5.1) * zoo(v.1.8-14) * sm(v.2.2-6.0) *
 mvMORPH(v.1.2.1) * subplex(v.1.9) * corpcor(v.1.6.10) * bbmle(v.1.0.25.1)
 * lubridate(v.1.9.4) * forcats(v.1.0.0) * stringr(v.1.5.1) *
 dplyr(v.1.1.4) * purrr(v.1.1.0) * readr(v.2.1.5) * tidyr(v.1.3.1) *
 tibble(v.3.3.0) * ggplot2(v.3.5.2) * tidyverse(v.2.0.0) * geiger(v.2.0.11)
 * phytools(v.2.4-4) * maps(v.3.4.3) * ape(v.5.8-1)