DOI: 10.5061/dryad.k6djh9wbg
title: Data for: Does the evolution of ontogenetic niche shifts favor species coexistence? An empirical test in Trinidadian streams

description: A major question in ecology is how often competing species evolve to
 reduce competitive interactions and facilitate coexistence. One untested
 route for a reduction in competitive interactions is through ontogenetic
 changes in the trophic niche of one or more of the interacting species. In
 such cases, theory predicts that two species can coexist if the weaker
 competitor changes its resource niche to a greater degree with increased
 body size than the superior competitor. We tested this prediction using
 stable isotopes that yield information about the trophic position (δ15N)
 and carbon source (δ13C) of two coexisting fish species: Trinidadian
 guppies (Poecilia reticulata) and killifish (Rivulus hartii). We examined
 fish from locations representing three natural community types: 1) where
 killifish and guppies live with predators; 2) where killifish and guppies
 live without predators; and 3) where killifish are the only fish species.
 We also examined killifish from communities in which we had introduced
 guppies, providing a temporal sequence of the community changes following
 the transition from a killifish only to a killifish-guppy community. We
 found that killifish, which are the weaker competitor, had a much larger
 ontogenetic niche shift in trophic position than guppies in the community
 where competition is most intense (killifish-guppy only). This result is
 consistent with theory for size-structured populations, which predicts
 that these results should lead to stable coexistence of the two species.
 Comparisons with other communities containing guppies, killifish and
 predators and ones where killifish live by themselves revealed that these
 results are caused primarily by a loss of ontogenetic niche changes in
 guppies, even though they are the stronger competitor. Comparisons of
 these natural communities with communities in which guppies were
 translocated into sites containing only killifish showed that the
 experimental communities were intermediate between the natural
 killifish-guppy community and the killifish-guppy-predator community,
 suggesting contemporary evolution in these ontogenetic trophic
 differences. These results provide comparative evidence for ontogenetic
 niche shifts in contributing to species coexistence and comparative and
 experimental evidence for evolutionary or plastic changes in ontogenetic
 niche shifts following the formation of new communities. 
description: The data/data.csv file contains information
 on the ontogenetic niche shifts of the guppies and killifish in different
 natural and experimental communities. The data includes the following
 variables: Location:
 the location where the fish sample was collected (a factor variable with
 three levels: "predator", "no predator", and
 "killifish only"). Species: the species of
 fish (a factor variable with two levels: "guppy" and
 "killifish"). Size: the size of the fish in
 millimeters. δ15N: the stable isotope metric for
 trophic position. δ13C: the stable isotope metric for
 carbon source. The
 data set has 1,052 observations and 5 variables. The data set includes
 missing values that need to be removed or imputed before the
 analysis.
description: Overview This repository contains the R code
 for analyzing data on the ontogenetic niche shifts of two coexisting fish
 species, Trinidadian guppies (<em>Poecilia reticulata</em>)
 and killifish (<em>Rivulus hartii</em>), in three different
 natural community types and experimental communities. The study aims to
 test the prediction that competing species can reduce competitive
 interactions and facilitate coexistence through ontogenetic changes in the
 trophic niche of one or more of the interacting species.
 The project utilized stable isotopes (δ15N and δ13C) to examine
 fish from different locations representing the three natural community
 types, and experimental killifish and guppy communities. The results
 provide comparative evidence for ontogenetic niche shifts in contributing
 to species coexistence and comparative and experimental evidence for
 evolutionary or plastic changes in ontogenetic niche shifts following the
 formation of new communities. The R code in
 Main_script.R provides a reproducible and documented analysis of the data
 and can be used as a template for analyzing similar data sets. The data is
 in CSV format, which can be opened using a wide range of software
 programs, including: Microsoft Excel
 (proprietary) Google Sheets (web-based)
 LibreOffice Calc (open-source) Apache
 OpenOffice Calc (open-source) RStudio
 (open-source) Of these programs, R together with
 RStudio is the recommended software for analyzing the data in the CSV
 file, as it provides an integrated development environment (IDE) for the R
 programming language and includes tools for importing, manipulating, and
 visualizing data. RStudio is free and open-source and can be downloaded
 from the RStudio website (https://www.rstudio.com/). The R packages required for running the code
 in R/Main_script.R are listed in the requirements.R file. You can install
 the packages by running the following command in your R console:
 install.packages(c("MuMIn","partR2","stringr","plyr","lme4","lmerTest","Hmisc"))