/Liesbeek-River-isotopics

Open access repository for data-sets and analyses for my first publication, "Isotopic tracing of stormwater in the urban Liesbeek River" in Water SA 44(4):674-679

Primary LanguageRCreative Commons Attribution 4.0 InternationalCC-BY-4.0

Isotopic tracing of stormwater in the urban Liesbeek River

Water SA 44(4):674-679. DOI: 10.4314/wsa.v44i4.16

Ruan van Mazijk[1], Lucy K. Smyth[1,2], Eleanor A. Weideman[1,3] and Adam G. West[1,§]

  • [1] Department of Biological Sciences, University of Cape Town, Rondebosch, South Africa
  • [2] Institute for Communities and Wildlife in Africa (iCWild), University of Cape Town, Rondebosch, South Africa
  • [3] FitzPatrick Institute of African Ornithology, University of Cape Town, Rondebosch, South Africa
  • [§] Corresponding author: adam.west@uct.ac.za , +27 21 650 3628

This is an open access repository for data-sets and analyses for publication in review in Water SA

How to replicate our results

Clone this repository use git or a GitHub client, or download it as a .zip above.

Our results can be replicated either with the bash command-line-interface or in RStudio. After running the R-scripts, figures appear as TIFF-files in the working directory, while other outputs appear on the console.

Note, uncertainty-propagation.Rmd is an R Markdown document, showing the arithmetic behind how we propagated analytical uncertainty in our mass-balance model (to determine rainfall contribution to Liesbeek River storm-flow). It is viewable here.

In RStudio

Open the R-project in RStudio. Before you can run the R-scripts in analyses/, you must install the correct versions of R-packages used in our analysis. This is made easy by packrat, a version-controlled dependency manager for R-projects. To install the packages needed:

packrat::restore()

Once this is done, you can run the R-scripts in analyses/. These scripts automatically call on setup.R, to install all the required packages (with pacman), define our own functions, and load all our data as needed.

On the command line

Assuming you are using a Unix-like system, navigate to the project directory on the command line, using the appropriate path on your machine, which should look something like this:

cd ~/mypath/Liesbeek-River-isotopics/

Before you can run the R-scripts in analyses/, you must install the correct versions of R-packages used in our analysis. This is made easy by packrat, a version-controlled dependency manager for R-projects. To install the packages needed:

Rscript -e "packrat::restore()"

Once this is done, you can run the R-scripts in analyses/. These scripts automatically call on setup.R, to install all the required packages (with pacman), define our own functions, and load all our data as needed. For example:

Rscript analyses/make-fig-1.R
Rscript analyses/mass-balance.R