Skip to content

joelnitta/canopylife

Repository files navigation

canopylife

Code repository to run analyses and generate figures and manuscript for Nitta et al. 2020 "Life in the canopy: Community trait assessments reveal substantial functional diversity among fern epiphytes". New Phytologist https://doi.org/10.1111/nph.16607

All code is in R. The drake package is used to manage the workflow. To run all analyses and generate the manuscript, clone this repository, download the data, and run make.R.

Data

All data are stored on Dryad. After cloning the repository, download the following sets of zipped data to the data/ folder (click on the "Download Dataset" button for each link below):

The code needs the zipped data files to run, so if you unzip them yourself to inspect them, be sure to keep the original, zipped versions in data/.

Reproducible analysis with Docker

make.R requires various software packages to be installed, and may not work properly if package versions have changed. Therefore, a Docker image is provided to run the code reproducibly.

To use it, first install docker.

Clone this repository and download the data as described above.

Navigate to the cloned repository (where /path/to/repo is the path on your machine), and launch the container:

cd /path/to/repo
docker-compose up -d

Enter the container:

docker exec -it canopylife_analysis_1 bash

Inside the container, run make.R:

Rscript make.R

You will see the targets being built by drake, and the final manuscript should be compiled at the end as manuscript.pdf (for easy viewing) and manuscript.docx (for journal submission) in the results/ folder. Other results files (image files, SI, etc.) will also be output to results/.

For submission, a very small number of manual tweaks to manuscript.docx were made where indicated with FIXME comments in ms/manuscript.Rmd.

When it's finished, exit the container and take it down:

exit
docker-compose down

Editing with R Studio Server

If you want to interact with the code in R Studio Server within the docker container, open a browser and navigate to http://localhost:8787/ after running docker-compose up -d. In your session, be sure to run .libPaths("/renv") to set the library correctly before loading any packages (for some reason, this happens automatically with R at the command line, but not within R Studio).

Licenses

About

Life in the canopy: Community trait assessments reveal substantial functional diversity among fern epiphytes

https://doi.org/10.1111/nph.16607

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published