DOI: 10.5061/dryad.2v6wwq01k
title: Data and code from: Seed dispersal and seed predation networks highlight important dual roles for plants and vertebrates in a tropical forest

description: The dispersal and predation of seeds by animals are important, and
 inextricably linked, drivers of plant species diversity and ecosystem
 stability. Within tropical forests, these interactions involve diverse
 vertebrate communities with the same species often contributing to both
 processes. Yet, multi-level interactions are rarely examined at
 community-scales, limiting our ability to identify the most important
 species driving plant recruitment – a crucial aspect of demographic
 dynamics. Here, we build a multi-layered network of vertebrate seed
 dispersal and seed predation interactions from a tropical forest in
 Thailand, to identify important interactors and assess the plant and
 animal traits that influence species’ roles. The dataset encompassed
 interactions between 36 plant and 25 ground-foraging vertebrate species
 observed in camera-traps (&gt;1000 camera-trap days). Over half the
 plant and animal species were involved in both dispersal and predation,
 with the dispersal network involving more species than the predation
 network. Four of six animal species that were major interactors had dual
 roles and two were seed predators, indicating that analyses of networks in
 isolation would incompletely reflect their importance in plant
 recruitment. Abundance was positively associated with species’ roles
 (degree, species strength) for plants and animals in the seed dispersal
 network but not the predation network; none of the size traits (fruit/seed
 size; body mass) nor seed hardness were related to species’ roles. Plant
 multi-layer versatility, a measure of relative importance within and
 between interaction types, was not correlated with any measured traits,
 suggesting that more complex trait associations define versatility. In
 conclusion, the most important species for influencing patterns of plant
 recruitment are more accurately identified by measuring roles across
 multiple levels, because of the dual involvement of plant and animal
 species in both seed dispersal and predation. However, a broader range of
 traits that might determine these roles needs to be studied. This Dryad
 repository contains all the data and code necessary to reproduce the
 analyses and figures in the study. A Read Me file containing a description
 of all the contents of this repository, usage notes and outputs is
 provided.
description: # Data and code from: Seed dispersal and seed predation networks highlight
 important dual roles for plants and vertebrates in a tropical forest
 Dataset DOI: [10.5061/dryad.2v6wwq01k](10.5061/dryad.2v6wwq01k) ##
 Description of the data and file structure This data repository consists
 of the following files: 1. Information on data files, code, and how to
 replicate analysis (**"ReadMe.docx"** and
 "**README.md**") 2. Data files (“**Interaction data.xlsx**”,
 “**Animal traits.xlsx**”, “**Plant traits.xlsx**”) 3. R scripts to perform
 all data processing and analyses (“**prep-data.R**”,
 “**calc_network_metrics.R**”, “**multilayer_analysis.R**”,
 “**analyse_species_metrics.R**”) To run the R script on your local
 machine, you will first need to specify your local working directory by
 setting the working directory to the folder containing all the files,
 using the setwd() function. Output will automatically be written into the
 defined working directory. ### Files and variables #### File:
 analyse_network_metrics.R **Description:** R script to perform analysis of
 interaction importance and network metrics #### File: Animal_traits.xlsx
 **Description:** Trait and abundance data for animal species #####
 Variables * **Animal species:** Species names of animals recorded using
 camera traps  * **Common name**: Common name of animal species *
 **Family**: Taxonomic family of animal species * **Order**: Taxonomic
 order of animal species * **Diet**: Broad categorisation of animal
 species' dietary niche * **Body mass**: Body mass in grams * **%
 camera-trap success (Luskin unpublished)**: Relative frequency of animal
 occurrence in camera traps. Empty cells = species was not recorded in the
 camera trap study. #### File: calc_network_metrics.R **Description:** R
 script to calculate species-level and community-level network metrics ####
 File: Plant_traits.xlsx **Description:** Trait and abundance data for
 plant species ##### Variables * **Plant species:** Species name of focal
 plants observed using camera traps  * **Family**: Taxonomic family of
 plant species * **BA m2**: Total basal area of species in the Mo Singto
 ForestGeo plot. Basal area for liana species was not recorded in the plot
 and hence recorded as "NA (liana)". * **Fruit colour**: Dominant
 colour of fruit or seed (for arillate seeds) * **Fruit length (mm)**:
 Length of fruit in millimetres * **Seed length (mm)**: Length of seed in
 millimetres * **Seed protection**: Hardness of seed #### File:
 multilayer_analysis.R **Description:** R script to perform multi-layer
 network analysis #### File: Interaction_data.xlsx
 **Description:** Interaction frequency data for seed predation and seed
 dispersal interactions The dataset contains two sheets, one for seed
 predation data ("Seed predation" sheet) and seed dispersal data
 ("Seed dispersal" sheet). They both contain the following
 columns: ##### Variables * **Plant species:** Species name of focal plants
 observed using camera traps  * **Family**: Taxonomic family of plant
 species * **#camera trap days**: The number of days that fruits/seeds for
 a plant species were observed using camera traps (the same for seed
 predation and seed dispersal sheets as they are based on the same camera
 trap data) * **Animal columns**: Interaction frequency (seconds per camera
 trap day) of each animal species with each plant. #### File: prep-data.R
 **Description:** R script to prepare interaction data for further analysis
 #### File: ReadMe.docx **Description:** Word Doc version of README file.
 ## Code/software To run this code you will need an installation of R and
 some R packages. A list of these R packages can be found below, but this
 list may not include all of their dependencies. Feel free to get in
 contact if you have trouble running the script. Code was tested on R
 version 4.4.0 with the following packages attached (version number in
 parentheses): BiMultiNetPlot (v.0.1.0), bipartite (v.2.2.0), cowplot
 (v.1.1.3), dplyr (v.1.1.4), ggplot2 (v.3.5.1), muxViz (v.3.1), plyr
 (v.1.8.9), readxl (v.1.4.3) , reshape2 (v.1.4.4), stringr (v.1.5.1),
 tidyverse (v.2.0.0). To fully replicate the analysis, the following R
 scripts should be run in order. Expected output files are described and
 named below: 1.     Prepare data (**prep-data.R**) * Reads in raw
 interaction data and generates a long-form versions:
 “**dispersal_clean.csv**” and “**predation_clean.csv**” 2.     Calculate
 network metrics (**calc_network_metrics.R**) * Generates a long-form data
 frame containing both dispersal and predation information for all animal
 and plant species pairs (**combined_df.csv**). * Calculates species-level
 network metrics for both seed dispersal and seed predation networks, and
 animal and plant species, separately (“**dispersal_animal_metrics.csv**”,
 “**dispersal_plant_metrics.csv**”, “**predation_animal_metrics.csv**”,
 “**predation_plant_metrics.csv**”) 3.     Performs multi-layer network
 analysis (**multilayer_analysis.R**) * Calculates versatility (node
 centrality) for each plant species (“**plant_node_centrality.csv**”) *
 Plots the multi-layer network as a tripartite network
 (“**tripartite_plot_lab.pdf**”) 4.     Performs analysis of interaction
 importance and network metrics (**analyse_network_metrics.R**) * Calculate
 absolute and relative importance of plant species in both seed dispersal
 and predation networks (“**plant_importance.csv**”), and plots the
 respective figures
 (“**plant_abs_importance.pdf**”,**“plant_rel_importance.pdf**”,
 “**plant_combined_importance.pdf**”) * Calculate absolute and relative
 importance of plant species in both seed dispersal and predation networks
 (“**animal_importance.csv**”), and plots the respective figures
 (“**animal_abs_importance.pdf**”,**“animal_rel_importance.pdf**” ,
 “**animal_combined_importance.pdf**”) * Compiles data of all species-level
 network metrics and traits for plant and animal species
 (“**animal_res.csv**” and “**plant_res.csv**”) * Performs correlation
 tests between species-level network metrics (including plant multi-layer
 versatility scores) and trait/abundance variables, exports the results
 (“**plant_network_analysis_res.csv**”,
 “**animal_network_analysis_res.csv**”), and plots them
 (“**plant_network_cor.pdf**”, “**animal_network_cor.pdf**”,
 “**versatility_combined.pdf**”)