This code was used to analyze data from a series of experiments on the expression of phenotypic plasticity in the larvae of two echinoid species. These experiments were part of a study that is described in Nilsson & Pernet (2022).
This code can be used to generate the figures and tables that appear in the article (less a few formatting details).
To see the most recent version - which may be updated to reflect URLs not known at the time this document was written - visit the github page.
To run this script, you need...
-
The R language (version ≥ 4.1), along with the following R packages and their dependencies: config, emmeans, ggpubr, kableExtra, lmerTest, multcomp, reticulate, rstatix, and tidyverse.
-
Python (version ≥ 3.8), along with the Beautiful Soup 4 package.
-
The two data files, which are stored in the Biological & Chemical Oceanography Data Management Office database as part of an NSF-funded project. At the time of writing, the URLs at which this data will be located are not known, but the script will attempt to download them automatically. Should that fail, simply obtain the data files and place them in a subdirectory named
data
like this:NilssonPernet2022/ ├── data/ │ ├── density_morphometrics.csv <- Add this! │ └── density_counts.csv <- Add this too! ├── main.R └── (various other files and directories...)
If you find some dependencies are missing, you can try running the install_dependencies()
function in code/setup.R
, which will attempt to download and install everything for you. I haven't really tested this; it is just for the convenience of anyone trying to run this script.
Once everything is set up, simply source the file main.R
in the R interpreter:
source("main.R")
This should generate HTML output files for each of seven tables (Tables 1-2, S1-S5) and SVG output files for each of five figures (Figures 2-5, S1). It will also generate an HTML output file containing a small table of data on count control larvae, which is summarized in prose in the paper. You can customize the output by editing the config.yml
file. Note that there is no output for Figure 1 because that figure is simply an illustration and is not generated from the data.
Output files are put in a directory named output
:
NilssonPernet2022/
├── output/
│ ├── Fig_2.svg
│ ├── Fig_3.svg
│ └── (various other output files...)
├── main.R
└── (various other files and directories...)
Nilsson P, Pernet B (2022) Echinoid larvae can express food-conditioned morphological plasticity at ecologically relevant culture densities. Marine Ecology Progress Series 694 (in press).