DOI: 10.5061/dryad.6hdr7sqwt
title: Data and code for: Past and future extinctions shape the body size - fruit size relationship between palms and mammalian frugivores

description: The dispersal of seeds by mammalian frugivores influences the structure
 and composition of plant communities, but most ecosystems have undergone
 defaunation over thousands of years, a process that continues today.
 Understanding how past defaunation has affected fruit-frugivore
 interactions will thus provide insights into how ecosystems may respond to
 future frugivore loss. By integrating palm and mammalian frugivore trait
 and occurrence data worldwide, we reveal a global positive relationship
 between fruit size and body size of frugivore assemblages. Global
 variation in fruit size is better explained by present-day frugivore
 assemblages compared to those of the Late Pleistocene (including extinct
 species), suggesting a substantial ecological and evolutionary
 reorganization after Pleistocene mammal extinctions. Interestingly, the
 reverse is true for the Neotropics where some large-fruited palm species
 may have persisted over thousands of years following extinction of their
 main seed dispersers. Simulations of frugivore extinction over the next
 100 years suggest that changes in body size will require up to a 4%
 assemblage-level decrease in palm fruit sizes to maintain the current
 global frugivore body size - fruit size relationship. Absolute changes in
 assemblage-level means of palm fruit size were on average up to two-fold
 higher than observed species-level estimates of seed size change following
 defaunation. Overall, our results suggest that while some large-fruited
 palms may persist after the loss of their main dispersers, many palms may
 be unable to keep pace with future defaunation through evolutionary
 changes in fruit size alone. The burden of the impact of the extinction of
 seed dispersers will probably be disproportionately borne by large-fruited
 palms, possibly over thousands of years to come.
description: Please refer to the Methods section and Supplementary Information
 of the published article.
description: Contents This data repository consists of
 the following folders and files: Main
 folder Word document containing information on each
 file and instructions for use (<b>"README.docx")</b>
 `data` folder 
 Palm checklist (presence-absence) data at scale of botanical
 countries (`<strong>palms_in_tdwg3.csv</strong>`)
 Palm fruit size trait data
 (`<strong>PalmTraits_10.csv</strong>`)
 Botanical country climatic variables
 (`<strong>TDWG_Environment_AllData_2019Feb.csv</strong>`) Mammal body size and IUCN Red List status (`<strong>Phylacine_Trait_data.csv</strong>`) Mammal diet data (extant mammals) (`<strong>MammalDIET_v1.0.txt</strong>`) Mammal diet classification (extinct mammals) (`<strong>frugivoreClassifcation.csv</strong>`) Mammal checklist (presence-absence) data at the scale of botanical countries for "current" scenario (`<strong>mammal_curr_occ.csv</strong>`) Mammal checklist (presence-absence) data at the scale of botanical countries for "present-natural" scenario (`<strong>mammal_presnat_occ.csv</strong>`) Pre-processed polygon information for botanical country units globally (`<strong>tdwg_shp_fort.rds</strong>`) `src` folder R script to estimate extinction probabilities (`<strong>estimateExtinctionRates.R</strong>`) R script to generate variables at botanical country scale, including future frugivore body size after extinction simulations (`<strong>generateTDWGdata.R</strong>`) R script to perform model averaging and project defaunation impact (`<strong>analyzeData.R</strong>`) R script to generate figures in manuscript (`<strong>figures.R</strong>`) R script defining wrapper functions that perform model averaging and generate confidence intervals (`<strong>modavg.R</strong>`) Metadata <strong>Palm checklist data at scale of botanical countries (`palms_in_tdwg3.csv`)</strong> This dataset was obtained from the Kew World Checklist of Selected Plant Species (http://wcsp.science.kew.org/home.do; downloaded June 2015) and contains the following columns: <strong>Area_code_L3</strong>: TDWG level 3 (botanical country) unit  (Brummitt <em>et al.</em> 2001 World geographic scheme for recording plant distributions. Intenational Working Group on Taxonomic Databases for Plant Sciences, Pittsburg, PA, U.S.A.; https://www.tdwg.org/standards/wgsrpd/) <strong>SpecName</strong>: Palm species name <strong>Palm fruit size trait data (`PalmTraits_10.csv`)</strong> This dataset is the Palm Traits database v.1 (Kissling, W.D. <i>et al.</i> PalmTraits 1.0, a species-level functional trait database of palms worldwide. <i>Sci Data</i> <b>6, </b>178 (2019). https://doi.org/10.1038/s41597-019-0189-0). An up-to-date version of this dataset and associated metadata may be obtained from https://datadryad.org/stash/dataset/doi:10.5061/dryad.ts45225. <strong>Botanical country climatic variables (`TDWG_Environment_AllData_2019Feb.csv`)</strong> <strong>LEVEL_3_CO</strong>: TDWG level 3 (botanical country) unit <strong>ID</strong>: ID number <strong>LEVEL_NAME</strong>: Name of botanical country unit <strong>REGION_NAM</strong>: Region of botanical country unit <strong>CONTINENT</strong>: Continent of botanical country unit <strong>REALM_LONG</strong>: Biogeographic region of botanical country unit <strong>AREA_KM2</strong>: Geographic area of botanical country unit <strong>LAT</strong>: Latitude of centroid of botanical country unit <b>LONG</b>: Longitude of centroid of botanical country unit <strong>bioX_mean</strong>: Mean value of bioclimatic variable X within botanical country unit (30 arc-second resolution; https://chelsa-climate.org/bioclim/) <strong>bioX_sd</strong>: Standard deviation of values of bioclimatic variable X within botanical country unit (30 arc-second resolution; https://chelsa-climate.org/bioclim/) <strong>lgm_ens_Tmean</strong>: Mean value of mean annual temperature within botanical country averaged across Last Glacial Maximum GCMs (30 arc-second resolution; https://chelsa-climate.org/last-glacial-maximum-climate/) <strong>lgm_ens_Pmean</strong>: Mean value of annual precipitation within botanical country averaged across Last Glacial Maximum GCMs (30 arc-second resolution; https://chelsa-climate.org/last-glacial-maximum-climate/) <strong>Mammal body size and IUCN Red List status (`Phylacine_Trait_data.csv`)</strong> The PHYLACINE trait dataset and associated metadata (Faurby <em>et al</em>. 2018 Phylacine 1.2: The Phylogenetic Atlas of Mammal Macroecology, <i>Ecology</i>, 99, 2626.) are stored in this Dryad Digital Repository (https://datadryad.org/stash/dataset/doi:10.5061/dryad.bp26v20) <strong>Mammal diet data (extant mammals) (`MammalDIET_v1.0.txt`)</strong> The MammalDiet database v1 (Kissling <i>et al.</i> 2014 Establishing amcroecological trait datasets: digitization, extrapolation, and validation of diet preferences in terrrestrial mammals worldwide, <i>Ecology and Evolution</i>, 4, 2913 - 2930.) was used to identify frugivores among extant species. Dataset and associated metadata are stored in this digital repository (https://datadryad.org/stash/dataset/doi:10.5061/dryad.6cd0v) <strong>Mammal diet classification (extinct mammals) (`frugivoreClassifcation.csv`)</strong> Taxonomy and diet scores are derived from the PHYLACINE dataset (Faurby <em>et al.,</em> 2018). However, proportion of species that are frugivorous at the family-level and order-level were calculated using the MammalDiet dataset (NA = extinct taxon does not have extant relatives in the same family or order, respectively). <strong>Order: </strong>Taxonomic order of mammal taxon <strong>Family</strong>: Taxonomic family of mammal taxon <strong>Binomial.1.2</strong>: Species name of mammal taxon <strong>Diet.Plant</strong>: Proportion of plant in diet <strong>Diet.Vertebrate: </strong>Proportion of<strong> </strong>vertebrates in diet <strong>Diet.Invertebrate: </strong>Proportion of<strong> </strong>invertebrates in diet <strong>Diet.Method</strong>: Method used to estimate diet category scores <strong>Diet.Source</strong>: Reference used for diet category scores <strong>famPropFrug</strong>: Proportion of extant species in the same taxonomic family that are primarily or secondarily frugivorous <strong>famPropOblgFrug</strong>: Proportion of extant species in the same taxonomic family that are primarily frugivores <strong>orderPropFrug</strong>: Proportion of extant species in the same taxonomic order that are primarily or secondarily frugivorous <strong>orderPropOblgFrug</strong>: Proportion of extant species in the same taxonomic order that are primarily frugivorous <strong>Liberal</strong>: Whether taxon is included our "Liberal" definition (Y = yes, N = no) <strong>Default</strong>: Whether taxon is included our default definition (Y = yes, N = no) <strong>Conservative</strong>: Whether taxon is included our "Conservative" definition (Y = yes, N = no) <strong>Notes</strong>: Additional notes <strong>Mammal checklist (presence-absence) data at the scale of botanical countries for "current" and "present-natural" scenario (`mammal_curr_occ.csv`)</strong> Data represent checklists of frugivore species at the scale of botanical country units. Both files contain the following columns: <strong>LEVEL_3_CO</strong>: TDWG level 3 (botanical country) unit <strong>LEVEL_NAME</strong>: Name of botanical country unit <strong>REGION_NAM</strong>: Region of botanical country unit <strong>CONTINENT</strong>: Continent of botanical country unit <strong>SpecName</strong>: Species name of species in current scenario <strong>falsePos</strong>: Flagged records (false positives) to be omitted <strong>Pre-processed polygon information for botanical country units globally (`tdwg_shp_fort.rds`)</strong> This file is derived from a shape file of TDWG level 3 / botanical country polygons (downloaded from: https://github.com/tdwg/wgsrpd). To create this file, I first read the shapefile into R using the function `rgdal::readOGR` and subsequently converted the "SpatialPolygons" object into a "data.frame" object using the function `ggplot2::fortify`. This object (saved as an RDS file) is needed for all the maps. System Requirements To run this code you will need a current installation of R and some R packages. This includes both for the analysis of data and the plotting of the figures in the manuscript. Feel free to get in contact if you have trouble running the script. Code was tested on R version 3.5.1 and the following packages (and versions accordingly): `stringr` (v1.4.0), `scales` (v1.0.0), `cowplot` (v1.0.0), `reshape2` (v1.4.3), `MuMIn` (v1.43.6), `viridis` (v0.5.1), `wesanderson` (v0.3.6), `RColorBrewer` (v1.1-2), `ggplot2` (v3.2.1), `rgdal` (v1.4-4), `sp` (v1.3-1), `relaimpo` (v2.2-3), `car` (v3.0-2), `care` (v1.1.10), `spatialreg` (v1.1-3), `spdep` (v1.1-2) Installation of all neccessary packages may be performed by running the following line of code in R:<br> `install.packages(c("rgdal, "relaimpo", "care", "ggplot2", "MuMIn", "plyr", "car", "spdep", "spatialreg", "wesanderson", "reshape2", "scales", "cowplot", "RColorBrewer", "stringr"), dependencies = TRUE)` To run the R script on your local machine, you will first need to specify your local working directory by modifying the "main.dir" variable in the R script. Output will automatically be written into pre-defined folders (e.g., "results", "figures") in your defined working directory. If those pre-defined folders do not exist, they will automatically be created. Instructions for use IMPORTANT: To perform a full analysis, the following R scripts have to be run in sequence. The "main.dir" variable at the start of each R script needs to be changed to the path of the folder in your local machine. Step 0: Estimate extinction probabilities (`estimateExtinction.R`) Has to be run first so frugivore body size under defaunation can be calculated in the next step Produces a file containing extinction probabilities using different sources (see Methods in published paper) Step 1: Compute body size and fruit size at the scale of botanical countries (`generateTDWGdata.R`) Generate summary statistics (i.e., maximum and median body size and fruit size for each botanical country) Imputation of trait values for palm species without data Implement probabilistic simulations of future extinction Step 2: Implement model averaging (`analyzeData.R`) Performs model averaging of ordinary least squares (OLS) and spatial autoregressive (SAR) linear models of fruit size at both global and regional scales Projects fruit size under future scenarios of defaunation Uses wrapper functions for model averaging in `<strong>modavg.R</strong>` Step 3: Plot figures (`figures.R`) Produces all figures in the manuscript Output All output files ("results" and "figures" folders) are already provided, but running the scripts in order (see Instructions for Use) will regenerate the same files. These include Maximum likelihood estimates of transition rates (including those from parametric bootstraps) between IUCN categories using Hoffmann and Di Marco datasets Model averaging results (see also Supplementary Table 1 - 6) PCA loadings for climatic variables at both global and regional scales (see also Supplementary Table 8) Processed files to facilitate plotting