This chapter of my dissertation leveraged publicly available data, supplemented with unpublished records provided by collaborators, to test the dilution effect hypothesis in the amphibian-Bsal system. This GitHub repository is where all files included in data collection, processing, and analysis can be found. Included R files correspond with data cleaning and data analyses for this chapter. Details on program and package versions can be found below in the Project Requirements section of this document.
This project primarily uses R within the RStudio IDE. Version control within the R project is maintained using the renv package. The versions of R and renv are listed below, with links to their respective sources. These versions are absolutely necessary to effectively run both the dataCleaning.R and dataAnalysis_DEH.R scripts.
All other info regarding R package versions can be found in the renv.lock file.
Python was used to obtain weather data from the GLDAS dataset available through NASA EarthData, and QGIS was used to process the .nc4 files. The weather data has already been integrated into our dataset, but if you wish to run any of the .py scripts in the weatherSampling folder, you will need the following versions of Python and QGIS:
(image credit: UBC Library Research Commons)
-
Please fork this repo if you intend to use or modify any of the code to avoid future merge conflicts. Forking will allow you to make changes to your own copy of the repository without affecting any of the files in this repository. This github.io page has an excellent section explaining both the 'why' and 'how' of forking repositories.
-
After you have forked this repository, you may then clone the forked repository to your local system. Cloning forked repositories may be done from Git Bash or from Command Prompt. In either case, the syntax is the same for cloning repositories:
git clone https://github.com/GitHub_username/forked-repo-name -
In R, navigate to the folder containing the cloned repository and open the Chapter-2-Analyses.Rproj file.
- This project file will organize the R environment so that all relevant scripts, files, and sub-folders are structured how they need to be to efficiently run the R scripts. Click here to learn more about R projects.
-
Within the opened project, open the dataAnalysis_DEH R script.
-
Before running any part of the script, make sure the renv package is installed and loaded:
install.packages('renv', version = '1.0.5') require(renv) -
You will then need to call
renv::restore()to reinstall the specific package versions used in this project. -
Once the required package versions have been installed, you are ready to run the R script. Happy coding! 🎊
Notes:
-
All specific location data (i.e., Lat and Lon) have been removed from .csv files out of consideration for sensitive populations. All data may be available upon request, with permission from the co-authors.
-
The data cleaning file may still be run from line 1495 onward by opening the dataCleaning.Rdata file in the R Global Environment and loading the required packages (lines 1-43).
The purpose of this repository is to ensure code reproducibility for this project. While feedback is appreciated, I ask that you refrain from submitting pull requests.
Collaborators on this project include Philipp Böning, Jaime Bosch, Stefan Lötters, An Martel, Frank Pasmans, Michael Veith, and Jason R. Rohr. This project exists thanks to their contributions.