DOI: 10.5061/dryad.18931zd4s
title: Data for: Increasing aridity may threaten the maintenance of a plant defense polymorphism

description: It is unclear how environmental change influences standing genetic
 variation in wild populations. Here, we characterized environmental
 conditions that protect vs. erode polymorphic chemical defenses in
 Boechera stricta (Brassicaceae), a short-lived perennial wildflower. By
 manipulating drought and herbivory in a four-year field experiment, we
 measured the effects of driver variation on vital rates of genotypes
 varying in defense chemistry and then assessed interacting driver effects
 on total fitness (estimated as each genotype’s lineage growth rate, λ)
 using demographic models. Drought and herbivory interacted to shape vital
 rates, but contrasting defense genotypes had equivalent total fitness in
 many environments. Defense polymorphism thus may persist under a range of
 conditions; however, ambient field conditions fall close to the boundary
 of putatively polymorphic environment space, and increasing aridity may
 drive populations to monomorphism. Consequently, elevated intensity and/or
 frequency of drought under climate change may erode genetic variation for
 defense chemistry in B. stricta. NOTE: A previously published version of
 this dataset was removed due to licensing issues. Please use the updated
 version now available.
description: Data were collected by monitoring the survival, growth, and
 reproduction of experimental genotypes differing at a genetic locus
 controlling defense chemistry. These genotypes were transplanted into
 field conditions where we manipulated two putative drivers of natural
 selection on defense chemistry: drought and herbivory. We then process raw
 census data from the field to parameterize demographic models that
 integrate the effects of these two drivers on vital rates and total
 fitness for each genotype.
description: # Data for: Increasing aridity may threaten the maintenance of a plant
 defense polymorphism Corresponding author Lauren N. Carley:
 [lauren.n.carley@gmail.com](mailto:lauren.n.carley@gmail.com) ## STRUCTURE
 OF THIS ARCHIVE: Details on the purpose of each file in these folders, and
 their sub-directories, are provided below, following the general outline:
 ``` cfr-drought-herbivory-archive-R3/ README.txt 1-data/ 2-modelsel/
 3-ipm/ out_concat/ 4-analyses/ figures/ ``` ```
 cfr-drought-herbivory-archive-R3/ ``` This directory contains all of the
 other subdirectories, which take you through data processing, modeling,
 and analysis step by step. It also contains one file: ``` README.txt ```
 You are currently reading this text file. It explains all of the other
 files associated with this archive. ```
 cfr-drought-herbivory-archive-R3/1-data/ ``` This folder contains data
 from the field transplant experiments described in this paper. It also
 contains one code file ('cfr-transplants-cleanup.Rmd') that is
 used to clean and process the raw data and one subdirectory
 ('environmental/') which contains additional data on the abiotic
 environment that complement the transplant data. ```
 cfr-transplants-cleanup.Rmd ``` This code file takes the raw field
 transplant data and performs basic processing and cleanup functions to
 prepare it for analysis. Specifically, it reshapes raw data from
 "long" (1 row per plant-year combination) to "wide" (1
 row per plant; repeated columns for each measurement taken in each census
 year), checks for and corrects mistaken records of
 "reincarnation" (plants marked as dead even though they are
 observed as alive in future years; caused either by censusing errors or by
 temporary die-back of aboveground tissue followed by resprouting),
 performs some basic manipulation and parsing for readability, and
 calculates derived variables. This code reads in one file
 ('CFRs-schofield-drt-x-herb-raw.csv') and writes out three
 ('CFRs-wide-raw.csv', 'CFRs-wide-clean.csv',
 'CFRs-long-clean.csv'), all of which are found in this same
 subdirectory. ``` CFRs-schofield-drt-x-herb-raw.csv ``` This file (.csv
 format, sep=",") contains the raw census data from the field
 transplant experiment described in this manuscript. In general, up to
 three censuses were performed during each growing season. For variables
 that were measured multiple times in a single season (once each across
 several censuses), the census time point is denoted by 0, 1, or 2.
 Timepoint 0 denotes an early-season census, at which point overwinter
 survival was assessed. These early censuses were typically conducted in
 early June of each census year. Timepoint 1 denotes a midsummer census,
 typically conducted in late June. Timepoint 2 denotes a late-season
 census, typically conducted in late July or August, when flowering and
 fruiting in surviving plants is complete or nearly complete given the
 environmental conditions in that year. Because census 0 does not capture
 data about within-season mortality, and takes place before herbivore
 damage is substantial and before surviving plants have begun to reproduce,
 most analyses focus on the late-season data (time point #2). The midsummer
 censuses (time point #1) were not conducted consistently across years, but
 are included here when available for completeness. Throughout the dataset,
 missing values are marked as NAs. Columns within the data file are as
 follows: * Site: The study site. Data reported in this manuscript were all
 collected from a single location, a common garden in Schofield Townsite,
 CO, USA; as such, all data rows are marked "S" (for Schofield)
 in this column. * Cohort: The year in which a given plant was transplanted
 into the Schofield common garden. Transplanting of juvenile rosettes took
 place in the fall of the indicated cohort year, and data on plant traits
 and fitness were collected beginning in the spring/summer following
 transplanting, through to August 2019. * PltNum: A unique identifier for
 each individual plant within a planting cohort. * Geno: The genotype of
 the focal plants, which are near-isogenic lines. "LL"=homozygous
 for branched-chain amino acid-derived glucosinolates at the BCMA1/3 locus;
 also referred to as "BB" (branched-chain homozygote) for
 clarity. "SS"=homozygous for methionine-derived glucosinolates
 at the BCMA1/3 locus; also referred to as "MM" (methionine
 homozygote) for clarity. * Fam: Genetic family. Unique family numbers
 indicate independent genetic lines nested within each genotype category to
 account for the effects of possible segregating loci outside of the
 genetic region of interest (BCMA1/3 locus). See Carley et al. 2021 Nature
 Ecology & Evolution for full details about crossing design and
 replication of families within genotypes. * Blk: ID number of statistical
 blocks in the common garden. Numbers are unique within planting cohorts
 and consist of 50 *B. stricta* individuals planted at 10 cm intervals into
 the surrounding habitat. * Drought: Drought treatment assignment;
 "C"=control (ambient rainfall) and "R"=reduced
 rainfall treatment, implemented via rainout shelters. Drought treatments
 were implemented at the block level, so all 50 plants in a given field
 block received the same treatment. * BT: Insecticide treatment assignment;
 "Y" = yes, received insecticide treatment (BT spray; described
 in methods); "N" = no, did not receive insecticide treatment;
 "X" = died before insecticide treatments began in 2017, so were
 not formally assigned to treatment at that time, but were effectively part
 of the control group prior to 2017. * Date_x_: The date that census *x*
 was conducted * Obs_x_: Initials of the observer who collected data in
 census *x* * Surv_x_: Survival at the time of census *x*; 0=dead, 1=alive.
 * TCO_x_: "Top chewed off" at the time of census *x*; refers to
 herbivory to the apical meristem rather than or in addition to leaf
 chewing. 0=no, 1=yes. * Veg_x_: Density (% cover) of heterospecific
 neighboring vegetation within a 5cm radius of the focal plant at the time
 of census *x*. This covariate was scored by ocular estimation and recorded
 in 5% bins. * Stg_x_: Categorical variable denoting the phenological stage
 of each individual at the time of census *x*. In phenological order, the
 categories scored were: "R"=juvenile rosette;
 "BO"=producing a bolting stalk; "FO"=a reproductive
 individual that has produced flowers only; "FS"=a reproductive
 individual that has produced both flowers and fruits (siliques);
 "SO"=a reproductive individual that has only siliques (all
 flowers have produced fruits); "X"=dead. * RosNum_x_: The number
 of rosettes each individual has at the time of census *x* * Ht_cm_x_: The
 height of the plant, in cm, at the time of census *x*. If the plant is
 non-reproductive (Stg=R), this is the length of the longest leaf in the
 rosette. For all other phenological stages, this is the height of the
 bolting stalk. * NumLvs_x_: The number of living leaves present on the
 plant at the time of census *x* * DamLvs_x_: The number of living leaves
 present on the plant that show evidence of herbivore damage at the time of
 census *x*. * AvgDam_x_: The average amount of leaf tissue removed by
 herbivore damage on each damaged leaf. This was estimated as % leaf area
 removed in 5% bins. * NumFrt: The number of fruits a plant had produced at
 the time of census 2. * LonFrt_cm: The length, in cm, of the longest fruit
 on a plant at the time of census 2. * AvgFrt_cm: The length, in cm, of an
 average fruit on a plant at the time of census 2. * FlwNotFrt: For
 reproductive plants that had not yet had all flowers mature into fruits at
 the time of census 2 (i.e., Stg=FO or FS), the number of flowers still
 present at the census time. * DateFirstFlr_Julian: The ordinal date (day
 of the year) that each individual was observed as flowering for the first
 time in a given season. * CensusYr: The year in which each field census
 was conducted. * Category: dummy variable; all individuals are NA. *
 State: Location in the USA of this experiment. All individuals are
 "CO". * LAR_x_: Total estimated leaf area removed by herbivores
 at the time of census *x*. A derived variable calculated from NumLvs,
 DamLvs, and AvgDam. * logLAR_x_: A derived variable calculated as
 log(LAR+1). Adding 1 avoids dropping 0 values from this column. * DidBolt:
 Binary derived variable indicating whether an individual bolted at all
 during the given year; 0=no, 1=yes. Individuals scored as entering any of
 the following phenological stages at any census time were identified as
 having bolted: BO, FO, FS, SO. * DidFrt: Binary derived variable
 indicating whether an individual fruited at all during the given year;
 0=no, 1=yes. Individuals scored as having entered any of the following
 phenological stages at any census time, and/or having NumFrt&gt;0, were
 identified as having fruited: FS, SO. * TotalRepro: Derived variable
 representing approximate total fitness, calculated by multiplying NumFrt
 and AvgFrt. * MaxRepro: Derived variable representing approximate maximum
 fitness, calculated by multiplying NumFrt and LonFrt. ```
 CFRs-wide-raw.csv ``` This file (.csv format, sep=",") contains
 the raw census data from the field transplant experiment described in the
 associated article but saved in "wide" format, i.e., one row per
 individual plant with columns repeated across each year of observations.
 This file is written by the Rmd code file in this subdirectory. All column
 names and contents are as described above in the raw long-form dataset,
 except that the census year is now transcribed in front of each variable
 that was observed multiple times across columns. In addition, the
 following two columns are present in the wide format that are not present
 in long form: * Expt: A dummy variable; all individuals are
 "transplants" * Unique: A unique ID for each individual plant
 that has no redundant values across planting cohorts. This is a
 concatenated string of garden, cohort, and PltNum. ``` CFRs-wide-clean.csv
 ``` This file (.csv format, sep=",") contains the cleaned,
 "wide-format" census data from the field transplant experiment
 described in this manuscript. It is written out by the Rmd code file in
 this subdirectory. All column names and contents are as described above,
 except now the character "X" precedes all census years in
 repeated columns. In addition, the following new columns have been added:
 * concat: the concatenated survival pattern for the individual across all
 census years (2016-2019). Concatenated survival patterns may exceed the
 number of census years when multiple survival censuses were conducted in a
 given year (e.g. 2016Surv0 and 2016Surv2 both measured). * Rein: A
 binary-derived variable identifying whether a pattern of apparent
 reincarnation has been identified in the "concat" string (i.e.,
 one or more zeroes flanked by 1s in the temporal survival sequence).
 1=yes, 0=no. * concat2: the concatenated survival pattern for the
 individual across all census years following any corrections executed in
 response to identifying an individual as Rein=1. ``` CFRs-long-clean.csv
 ``` This file (.csv format, sep=",") contains the cleaned,
 "long-format" census data from the field transplant experiment
 described in this manuscript. It is written out by the Rmd code file in
 this subdirectory. All column names and contents are as described above
 for the 3 other data files in this subdirectory. ```
 CFRs-Sept2015-preplanting.csv ``` This file (.csv format,
 sep=",") contains data on the size (length of the longest leaf)
 of juvenile rosettes prior to transplanting into the Schofield common
 garden. These data are used in the demographic model to estimate
 genotype-specific size distributions for new recruits. Contents are as
 follows: * Label: Text string containing a unique label for each juvenile
 plant * PltNum: Numerical unique identifier for each plant within this
 cohort; carried over to the PltNum in corresponding field census datasets.
 * Block: Greenhouse planting block number * Row: Greenhouse planting row
 number * Column: Greenhouse planting row column * Genotype: A concatenated
 identifier of the family line and genotype (see above for definitions of
 these); the format of the text string is "fam.geno" * COMMENT:
 notes; blank for all rows * LL mm: the rosette size, estimated as the
 length of the longest leaf, in mm ``` environmental/ ``` ``` This
 subdirectory contains additional data files containing environmental data
 that complements the plant census data. It contains 6 data files, one code
 file for processing these data, and one additional subdirectory
 ('historic/') that contains additional environmental data from
 the study region spanning 1985-2020. ``` ``` cfr_environmental.Rmd ```
 This R file (.Rmd format) contains code to clean and analyze environmental
 data describing the blocks in the transplant garden described in this
 manuscript. ``` light-2017.csv ``` This file (.csv format,
 sep=",") contains data describing light availability beneath
 rainout shelters and in control blocks in the common garden in 2017.
 Columns are as follows: * Cohort: Planting year of transplanted B. stricta
 individuals. * Block: Garden block of 50 randomly positioned plants; ID
 number is unique within cohorts. * Trmt: Block-level drought treatment
 assignment in the garden; "R"=rainout shelter implemented,
 "C"=control (ambient precipitation). * Timepoint: A dummy
 variable, aliased with Date, to indicate the time point at which a given
 set of light measurements were taken. * Date: The date on which a given
 set of block-level light measurements were taken; format MM/DD/YY * Time:
 The approximate time of day that a full set of light measurements were
 taken, across all blocks within a cohort; format HH:MM * Weather: A
 qualitative description of how clear the sky was at the time of light
 measurement; from sunniest to cloudiest, the categories are ranked as
 "Sunny" &gt; "Mostly sunny" &gt; "Partly
 cloudy" * PAR-*x*: The measurement of photosynthetically active
 radiation (µmol of photons per m^2 per s) taken at position *x* in a given
 garden block at a given measurement time. A, B, and C are replicate
 measurements taken from different positions in the garden block (back left
 corner, center, and front right corner, respectively) on the same
 measurement date. * AvgPAR: The mean photosynthetically active radiation
 (µmol of photons per m^2 per s) across positions A, B, and C in a given
 garden block at a given measurement date. ``` soil-moisture-_x_.csv ```
 These two files (.csv format, sep=",") contain soil moisture
 data collected in garden blocks during the year *x* (2017 or 2018). Across
 both files, columns are as follows: * Cohort: Planting year of a group of
 transplanted B. stricta individuals. * Block: Garden block ID for a group
 of 50 randomly positioned transplants; ID number is unique within cohorts.
 * Trmt: Block-level drought treatment assignment in the garden;
 "R"=rainout shelter implemented, "C"=control (ambient
 precipitation). * Time Point: Dummy variable aliased with Date; ordinal
 integer identifying the day on which soil moisture data were collected. *
 Date: Date of soil moisture data collection; format MM/DD/YY * Julian:
 Ordinal day of year of soil moisture data collection * Start time: The
 time that soil moisture data collection was begun for a planting cohort on
 a given measurement day; format HH:MM * VWC-*x*: The soil moisture (%
 volumetric water content) measured at position *x* in a given garden block
 at a given measurement time. A, B, and C are replicate measurements taken
 from different positions in the garden block (back left corner, center,
 and front right corner, respectively) on the same measurement date. * Mean
 VWC: The mean soil moisture (% volumetric water content) across positions
 A, B, and C in a given garden block at a given measurement date. ```
 soil-temp-_x_.csv ``` These two files (.csv format, sep=",")
 contain soil temperature data collected in garden blocks during the year
 *x* (2017 or 2018). Across both files, columns are as follows: * Cohort:
 Planting year of a group of transplanted B. stricta individuals. * Block:
 Garden block ID for a group of 50 randomly positioned transplants; ID
 number is unique within cohorts. * Trmt: Block-level drought treatment
 assignment in the garden; "R"=rainout shelter implemented,
 "C"=control (ambient precipitation). * Timepoint: Dummy variable
 aliased with Date; ordinal integer identifying the day on which soil
 temperature data were collected. * Date: Date of soil temperature data
 collection; format MM/DD/YY * Date_Julian: Ordinal day of year of soil
 moisture data collection * Start_time: The time that soil temperature data
 collection was begun for a planting cohort on a given measurement day;
 format HH:MM * Temp_C: The soil temperature (degrees C) at the center of a
 given block on a given measurement day at 10 cm depth. ```
 vwc-predvsobs-allyrs.csv ``` This file (.csv format, sep=",")
 contains block-level estimates of mean daily VWC during the growing
 seasons 2016-2019. (Growing season defined as the date of snowmelt in each
 year through September 1; see text for detail.) Columns are as follows: *
 Unique: Unique ID for garden blocks; a concatenated string containing
 "Unique", the cohort, and the block number within that cohort. *
 Trmt: Block-level drought treatment assignment in the garden;
 "Drought"=rainout shelter implemented,
 "Control"=control (ambient precipitation). * Year: The year in
 which soil moisture was measured or estimated * VWC.Obs: If measured, the
 mean observed volumetric water content (VWC) in that garden block on that
 day. * julian: Ordinal day of year of soil moisture data collection * Int:
 the block-specific intercept used to predict VWC on days in which it was
 not directly observed * Slp: the block-specific slope used to predict VWC
 on days in which it was not directly observed * Pred: the raw
 block-specific predicted VWC on each day of each growing season *
 Pred.Mod: the block-specific predicted VWC on each day of each growing
 season, correcting for mean annual differences in VWC (see Supplementary
 Table 2) ``` vwc-predvsobs-annualmeans.csv ``` This file (.csv format,
 sep=",") contains block-level estimates of mean VWC during the
 growing season from 2016-2019. (Growing season is defined as the date of
 snowmelt in each year through September 1; see text for detail.) Columns
 are as follows: * Year: The year for which growing season summary
 statistics were calculated * Unique: Unique ID for garden blocks; a
 concatenated string containing "Unique", the cohort, and the
 block number within that cohort. * Trmt: Block-level drought treatment
 assignment in the garden; "Drought"=rainout shelter implemented,
 "Control"=control (ambient precipitation). * VWC.Obs_cv: The
 coefficient of variation in VWC values across the season when direct
 block-level observations were taken. * Pred.Mod_cv: The coefficient of
 variation in predicted VWC values across all dates in a given growing
 season, whether or not direct block-level observations were taken. *
 VWC.Obs_mean: The mean VWC (proportion) across the growing season for
 blocks and years in which direct block-level observations were taken. *
 Pred.Mod_mean: The mean predicted VWC (proportion) across all dates in a
 given growing season, whether or not direct block-level observations were
 taken. ``` historic/ ``` This subdirectory contains raw historic climate
 data from a USDA Snow Telemetry (snotel) weather station located nearby to
 the common garden described in this manuscript, along with one code file
 to process these data, and one data file containing derived variables
 summarized from this dataset. ``` historic_climate_data.Rmd ``` This R
 file (.Rmd format) contains code to process and summarize historic climate
 data collected near the common garden described in this manuscript. The
 code extracts data from the focal years of this study (2016-2019) and then
 calculates summary statistics about summer and winter temperature and
 precipitation to report in Table 1 of the manuscript. ```
 Schofield-Snotel-Historic-noheader.txt ``` This data file (.txt format,
 sep="\t") contains environmental data collected at a USDA snotel
 weather station at Schofield Pass, CO (Site # 737; Latitude: 39 deg 1 min
 N; Longitude: 107 deg 3 min W; Elevation: 10653 feet). This station
 records a variety of climatic variables at daily resolution beginning in
 1985. This dataset extends through to 2020. This file contains the raw
 data that is processed by the Rmd scripts in this subdirectory to generate
 Supplementary Table 2 of the manuscript. Columns are as follows: * Date:
 Sample date in YYYY-MM-DD format * Snow Water Equivalent (in) Start of Day
 Values: Snow water equivalent, in inches, in the previous 24 hours *
 Precipitation Accumulation (in) Start of Day Values: Total cumulative
 precipitation, in inches, up to the current date in a "water
 year" (i.e. beginning October 1 of a given year and ending September
 30 of the following year) * Air Temperature Maximum (degF): Maximum air
 temperature, in degrees Fahrenheit, in the past 24 hours * Air Temperature
 Minimum (degF): Minimum air temperature, in degrees Fahrenheit, in the
 past 24 hours * Air Temperature Average (degF): Average air temperature,
 in degrees Fahrenheit, in the past 24 hours * Precipitation Increment
 (in): The amount of new precipitation, in inches, that accumulated in the
 past 24 hours. ``` Snotel-Summary-Metric.csv ``` This data file (.csv
 format, sep=",") contains derived summary statistics about
 summer and winter temperature and precipitation in Schofield, CO, as
 reported in Supplementary Table 2 of the manuscript. It is written out by
 the Rmd code in this subdirectory. Columns are as follows: * Year: The
 year for which climate data has been summarized * Winter.Precip.sum: The
 sum of precipitation, in cm, in the winter season preceding the growing
 season in the given year. "Winter season" is defined as
 beginning at the end date of the preceding summer season (September 1) and
 ending at the observed date of snowmelt in or near Schofield, CO
 (different in each year; described in-text). * Winter.SWE.max: The highest
 snow water equivalent, in cm, recorded in the winter season preceding the
 growing season in the given year. ("Winter season" is defined
 above.) * Summer.tmp.min: The minimum air temperature, in degrees C,
 recorded during the growing season in the given year. "Growing
 season" is defined as the period of time between the snowmelt date in
 Schofield, CO (different each year; described in-text) and September 1. *
 Summer.tmp.mean: The mean air temperature, in degrees C, recorded during
 the growing season in the given year. ("Growing season" is
 defined above.) * Summer.tmp.max: The minimum air temperature, in degrees
 C, recorded during the growing season in the given year. ("Growing
 season" is defined above.) * Summer.Precip.sum: The sum of all
 precipitation, in cm, that fell during the growing season in the given
 year. ("Growing season" is defined above.) ```
 cfr-drought-herbivory-archive-R3/2-modelsel/ ``` This subdirectory
 contains four data files, all of which are written out by the one code
 file located here ('cfr-VRRs-archive.Rmd'). These are the final
 files used for modeling vital rate regressions (VRRs) for the two
 genotypes and performing model selection to determine which driver(s) to
 retain in the final IPM. It also contains the subdirectory
 'modcomp' to hold the output of model selection comparisons. ```
 cfr-VRRs-archive.Rmd ``` This code file (.Rmd format) fits the vital rate
 models, performs model selection, and extracts parameters from the
 best-fit models. ``` best-fit-vrrs.csv ``` This data file (.csv format,
 sep=",") contains information about the best-fit vital rate
 regressions following model selection (used to make Supplementary Table
 5). * vrr: The vital rate regression; "surv" = survival;
 "boltX" = the probability of bolting at time t+1 given bolting
 state X in time t (1=bolting, 0= not bolting); "growthXY" =
 growth from time t to time t+1 for individuals of bolting state X in time
 t and Y in time t+1; "g.res.XY" = size-dependent residuals in
 growthXY; "repro" = the probability of reproduction conditional
 upon bolting; "seeds" = seed number, conditional upon
 reproduction. * geno: plant genotype; "BB" = near-isogenic line
 homozygous for branched-chain amino acid-derived glucosinolates;
 "MM" = near-isogenic line homozygous for methionine-derived
 glucosinolates. * best.fit: a character string defining the best-fit model
 for that genotype and vital rate following model selection, written in the
 R coding language * n: the sample size of the best-fit vital rate
 regression ``` vrr-data.csv ``` This data file (.csv format,
 sep=",") contains the final demographic data used when fitting
 the vital rate regressions, following additional light processing and
 filtering during model-fitting. Column names and contents are as defined
 above for the raw and cleaned demographic data. Downstream code files when
 used to define IPM parameters and make figures use this final version of
 the data. ``` modcomp/ ``` This subdirectory is empty, but when you run
 the code to do a model selection on the vital rate regressions, tables
 showing the model selection comparisons will be saved here. These were
 used to create Appendix S3 in the Supplementary Information of this
 manuscript. ``` cfr-drought-herbivory-archive-R3/3-ipm/ ``` This
 subdirectory contains 3 code files and 3 data objects that they use in
 order to construct the demographic models for each transplanted genotype.
 It also contains two shell scripts in order to execute the bootstrap
 simulations and to concatenate output from them for use in downstream
 analysis and visualization. ``` cfr_ipm_bootstrap_final.R ``` This R code
 evaluates the IPM across a range of driver values using sampled values for
 vital rate coefficients. This code is designed to run in parallel on a
 remote server that assumes the following file structure: ``` A main
 directory containing the following: bcma_final/
 cfr_ipm_source_functions_final_revised.R # functions to apply VRRs and
 build IPM vrr-data.csv # final demographic data cfr-vrr-coefs.Rdata # vrr
 coefficients cfr-vrr-vcovs.Rdata # vrr var-covar matrices
 cfr-size-ind-transitions.Rdata # size-independent vital rates
 cfr_ipm_bootstrap_final.R # code to sample coefficient distributions and
 build ipm from sampled values slurmErrors/ slurmOutputs/ Rout/ out_concat/
 A "scratch" directory to hold temporary files written out,
 including two subdirectories: bcma_final/ coefs/ lambdas/ ``` If
 you're trying to adapt this to run on your cluster, be sure to push
 the necessary code and data files to a directory with a similar structure
 there before running. Here, the code is set to just perform one bootstrap
 sample per run, so to scale up and do this many times in parallel, call
 the code numerous times using a job array of the desired size (here, 1,000
 bootstraps). ``` cfr_ipm_source_functions_final_revised.R ``` This R code
 contains source functions to parameterize and apply vital rate functions
 across the discretized IPM and evaluate lineage growth rates. It is used
 by both the mean and bootstrapped IPM codes described above. ```
 cfr-size-ind-transitions.Rdata ``` This R data object contains the values
 for the size- and driver-independent vital rates used in these IPMs. ```
 cfr-vrr-coefs.Rdata ``` This R data object contains the estimated values
 of the coefficients from vital rate regressions following model selection.
 ``` cfr-vrr-vcovs.Rdata ``` This R data object contains the
 variance-covariance matrices for the fixed effects in vital rate
 regressions following model selection. ``` bcma_ipm_bootstrap.sh ``` This
 shell script calls the R code
 "cfr_ipm_bootstrap_final_revised.R" and will run the IPM
 bootstrap simulations in parallel on a remote cluster the number of times
 you define at the top (here, 1,000, as indicated by --a 1000). ```
 out_concat.sh ``` This shell script accesses the output of the output of
 each bootstrap run (which is written out as a single small file per run
 and saved to the scratch directory defined in the R code) and concatenates
 them into two files for downstream analysis and data visualization. ```
 cfr_ipm_driver_and_vr_contribs_to_lambda.R ``` This R code approximates
 the contributions of each driver to lambda, mediated by each vital rate.
 ``` out_concat/ ``` This subdirectory contains the concatenated output
 from the bootstrap simulations. ``` bootstrapped_coefs.csv ``` This data
 contains the sampled coefficient values for driver- and size-sensitive
 vital rates during bootstrap simulations. The columns have no headers but
 contain the following information based on position: * 1: the row number
 of the coefficient data frame within a single bootstrap run. a consecutive
 set numbered 1-34 is a single sampling event. * 2: the vital rate * 3: the
 genotype * 4: the sampled intercept of the vrr * 5: the sampled effect of
 size on the vital rate * 6: the sampled effect of herbivory on the vital
 rate * 7: the sampled effect of soil moisture (VWC) on the vital rate * 8:
 the sampled interaction effect between plant size and herbivory on the
 vital rate * 9: the sampled interaction effect between size and soil
 moisture (VWC) on the vital rate * 10: the sampled interaction effect
 between herbivory and soil moisture (VWC) * 11: the sampled interaction
 effect between size, herbivory, and soil moisture (VWC) on the vital rate
 * 12: the sampled mean value for size-independent vital rates * 13: the
 sampled standard deviation for size-independent vital rates ```
 bootstrapped_lambdas.csv ``` This data file contains the output of the
 bootstrap sampling simulations. Columns have no headers, but are as
 follows: * 1: the row number of the data frame WITHIN a bootstrap sampling
 event * 2: the number of the bootstrap simulation * 3: the plant genotype
 * 4: the soil moisture (VWC) level at which the IPM was evaluated * 5: the
 herbivory level at which the IPM was evaluated * 6: the lambda calculated
 at the given level of VWC and herbivory for the given genotype using the
 vital rate coefficients sampled in this bootstrap run ```
 cfr-drought-herbivory-archive-R3/4-analyses/ ``` This subdirectory
 contains three code files that analyze the output of the bootstrap
 simulations and make the figures presented in the main text of the
 manuscript. It also contains two data files that contain summary
 information from the 1000 replicate bootstrap simulations and one data
 file that contains output from analyses of the contributions of drivers
 and vital rates to lambda. ``` cfr_fitness_surfaces_final.Rmd ``` This R
 code makes figures 2-4 in the main text. ```
 cfr_ipm_bootstrap_output_final.Rmd ``` This R code reads in the
 concatenated output of the parallel bootstrap simulations and summarizes
 the outcomes, calculating the median outcomes for each genotype across
 bootstraps within each environment cell, as well as the upper and lower
 confidence intervals around the medians. It then determines whether the
 permuted distribution of lambda for each genotype overlaps with or exceeds
 1 in each environment cell. Finally, it calculates the difference in
 lambda between genotypes and determines whether the permuted distribution
 of differences overlaps with zero. ``` cfr_VRR_functions_final.Rmd ```
 This R code plots the functional forms of each vital rate using the
 best-fit coefficients following model selection, generating Figure 1 in
 the main text. ``` bootstrap_comparisons.csv ``` This data file (.csv
 format, sep=",") contains information about the bootstrapped
 distributions of lambda for each genotype in each environment cell.
 Contents are as follows: * geno: the genotype * vwc: the soil moisture
 level (VWC) at which the IPM was evaluated * lar: the herbivory level (%
 lear area removed) at which the IPM was evaluated * geno.min: the minimum
 lambda for that genotype in that environment observed across all bootstrap
 simulations * geno.mean: the mean lambda for that genotype in that
 environment across all bootstrap simulations * geno.max: the maximum
 lambda for that genotype in that environment across all bootstrap
 simulations * lower.025.geno: the lambda value at the lower 2.5% tail of
 the bootstrapped distribution for that genotype in that environment *
 geno.median: the median lambda value for that genotype in that environment
 across all bootstrap simulations * upper.975.geno: the lambda value at the
 upper 97.5% tail of the bootstrapped distribution for that genotype in
 that environment * diff.min: the minimum value of lambda_mm minus
 lambda_bb across all bootstrap simulations * diff.mean: the mean value of
 lambda_mm minus lambda_bb across all bootstrap simulations * diff.max: the
 maximum value of lambda_mm minus lambda_bb across all bootstrap
 simulations * lower.025.diff: the lambda value at the lower 2.5% tail of
 the distribution of lambda_mm minus lambda_bb across all bootstrap
 simulations * diff.median: the median lambda value of the distribution of
 lambda_mm minus lambda_bb across all bootstrap simulations *
 upper.975.diff: the lambda value at the upper 97.5% tail of the
 distribution of lambda_mm minus lambda_bb across all bootstrap simulations
 ``` bootstrap_summary.csv ``` This data file (.csv format,
 sep=",") summarizes the outcomes of the bootstrap simulations.
 Contents are as follows: * vwc: soil moisture (VWC) value at which the IPM
 was evaluated * lar: the herbivory (% leaf area removed) value at which
 the IPM was evaluated * bb.ol.1: a binary value indicating whether or not
 the bootstrapped distribution of lambda values for the BB genotype in the
 given environment cell overlapped with or exceeded 1 (0=no, 1=yes) *
 mm.ol.1: a binary value indicating whether or not the bootstrapped
 distribution of lambda values for the MM genotype in the given environment
 cell overlapped with or exceeded 1 (0=no, 1=yes) * diff.ol.0: a binary
 value indicating whether or not the bootstrapped * distribution of
 differences in lambda values between genotypes (lambda_mm minus lambda_bb)
 overlapped with 0 (0=no, 1=yes) * geno.greater: the genotype with greater
 lambda in the given environment cell * diff.min: as defined in
 bootstrap_comparisons.csv * diff.max: as defined in
 bootstrap_comparisons.csv * diff.mean: as defined in
 bootstrap_comparisons.csv * diff.median: as defined in
 bootstrap_comparisons.csv ```
 approximate-driver-by-vrr-contributions-to-lambda.csv ``` This data file
 (.csv format, sep=",") summarizes the outcomes of analyses of
 proportional contributions of drivers and vital rates to lambda. Contents
 are as follows: * vrr: the (potentially) driver-dependent vital rate *
 geno: the genotype * driver: herbivory (h) or soil moisture (volumetric
 water content, vwc) * lam.orig: the lambda value for that genotype at the
 median value of each driver, estimated using the best-fit vital rate
 coefficients following model selection * lam.pert: the
 "perturbed" lambda value for that genotype at median values of
 each driver, except after adjusting the coefficients for the given driver
 to be 0 (effectively "turning off" that driver effect on that
 vital rate) * lam.diff: the difference between perturbed and unperturbed
 lambda for this genotype, vital rate, and driver (lam.orig-lam.pert) *
 contrib: the proportional contribution of this driver to lambda as
 mediated by this vital rate (lam.diff/lam.orig)
 `cfr-drought-herbivory-archive-R3/figures/` This subdirectory is where
 figures written out by code files in any of the above subdirectories will
 be saved. Figures presented in-text (either as main figures, supplemental
 figures, or appendix figures) are saved here. Because the figures are
 reproducible by running the code included in this archive and are
 presented in the manuscript, this directory is left intentionally empty in
 the archive.