First we load the R libraries we will need and manually set the working directory.

library(knitr)
#set knitr inline code to round to 2 decimals
knitr::opts_chunk$set(echo = TRUE)
inline_hook <- function (x) {
  if (is.numeric(x)) {
    # ifelse does a vectorized comparison
    # If integer, print without decimal; otherwise print two places
    res <- ifelse(x == round(x),
      sprintf("%d", x),
      sprintf("%.2f", x)
    )
    paste(res, collapse = ", ")
  }
}
knit_hooks$set(inline = inline_hook)

library(vegan)
library(ggplot2)
library(gridExtra)
library(RColorBrewer)
library(plyr)
library(dplyr)
library(reshape2)
library(lattice)
library(scales)
library(DT)

setwd("/Users/duhaimem/Box Sync/manuscripts_in_prep/highschool_WWTP/WWTP_git/")

Figures 1-3. Introducing the study system: three WWTPs and multiple sampling locations therein.