Intertidal Soft Sediment Bivalve Monitoring Analysis


R-File Structure

This document outlines the analysis of an previously conducted bivalve surveys data set, and allows for additional data or analyses to be integrated. The R-script is set up to generate a word, HTML or pdf document that reports the analysis, but removes the code. Text can be generated to include summary statistics that update when the data files are modified. This document has been coded to allow additional data to be added to any of the three excel files (bivalve community data, bivalve lengths, and survey locations), and the analysis re-run with minimal, if any, modifications to the code. All analyses are annotated to allow those new to coding in R to follow along.

This R Markdown document provides a simple formatting syntax for authoring HTML, PDF, and MS Word documents. Clicking visual on the top of this window will show what the resulting file will look like, and clicking the Knit button in the top to the window will generate the document includes the text and outputs from any embedded R code. More details on using R Markdown can be seen here: https://rmarkdown.rstudio.com/authoring_quick_tour.html.

The report objectives are coded below in respective subsections. All of the document code can be run at once, or the subsections can be run one at a time. To run the entire document, click ‘run’ in the top right corner and select ‘run’ all. There are several ways to run a subsection, but the easiets is to click the ‘play button’ in the top right corner of the chunk. Please note that the settings of each chunk can be customized, which has been done in several cases to not run code that does not need to be run each time (i.e. installing packages), set the figure display windows and other features. Notes have been made within the code about the specifics of these to ensure updating the report is as seemlessly as possible.

As figures are commonly needed for presentations and publications the code includes functions that will export high-resolution versions of each figure into whatever folder you save the R Markdown document in.

Report Objectives

  1. Survey Locations
  2. Bivalve Diversity and Abundance
  3. Species Pool
  4. Diversity Indices
  5. Introduced Clam Populations
  6. Bivalve Size Distributions
  7. Bivalve Age Distributions
  8. Bivalve Lengths-Width Relationships
  9. Bivalve Species Detection

R Packages Needed For Analysis

Several R packages will be used in this document. These packages include those listed in the code below. To ensure anyone is able to use this document, running the first chunk of code will install all of the packages used for the analyses, while the second chunk of code will load them into R.


Data Files

This analysis integrates three data files that are included in the folder and will be read into the R script as the code is run. The survey site locations are in ‘Bivalve_Survey_Locations_March23_2024.csv’, the bivalve community data is in ‘Bivalve_Data_March23_2024.csv’, and bivalve lengths are in Bivalve_Length_Data_March23_2024.csv. Each of these data files is set up to allow additional data to be added, and they include columns that will allow for the differences in survey method, region, or other factors to be analized.

Review Note: Sarah, let’s discuss your preference for how to manage the data file. There are several routes to streamlining the data integration into R. The two main options would be a GoogleDrive sheet that we can code to be drawn into the R script or a data file that we pull from a folder.

Review Note: Sarah, I remove shellfish and clam gardens from this data set. Let me know if you’d like either of these included.

1. Survey Locations

The current data was collected from four regions along the coast: Baynes Sound, Quadra Island, Calvert Island, and Gwaii Haanas. The aims for this section are to map the survey locations along coastal British Columbia, and map each region to show a more detailed outline of the locations. As mapping resolution varies considerably when using spatial analysis packages, and the aim of this work is to consider high and low resolution scale maps concurrently, I merged several high resolution maps in GIS to create a global high resolution map. This means that surveys can be conducted anywhere and seamlessly added to this maps.

Suvery Locations: Coastal Map

Survey Region: Baynes Sound

These region now should both ways we could show sites. One with specific locations and one with a general location. However, we could also just not make region maps public, and remove all site specific information.

Survey Region: Quadra Island

Survey Region: Calvert Island

Survey Region: Gwaii Haanas

Coastal Map and Suvery Regions

We have added sites so this figure will be a bit off until we update it, but we have talked at lot about not showing site locations so let’s decide on that before we revise/include this.

Exporting Survey Maps

The code chunk below will not be visual within the Rmarkdown document, however, if opened as an R-script it will make it easy to export maps of the various survey regions. I have removed these export functions from the script associated with developing each map to decrease the time required for the document to be Knitted into a report. If you would like all maps to be generated into your folder, click the ‘play symbol’ (i.e. Run Current Chunk) in the top right of the code window. If you would like generate a select map, highlight it and click command enter (on a Mac) or control enter (on a PC).

2. Bivalve Diversity and Abundance

Data Cleaning

As previously mentioned this analysis integrates three data files that are included in the folder and will be read into the R script as the code is run. To ensure that additional data can be added to these files without needing to modify this code, I have run several data cleaning processes that will be useful as more surveys are added.

Plotting Bivalve Diversity and Abundance

The aim of this subsection is to show bivalve diversity and abundance within each intertidal zone by the survey regions. However, this code can easily be adapted to include additional comparisons.

Species Diversity and Abundance By Region

Bivalve Species Diversity and Abundance by Site

#3. Species Pool We’ll use Venn Diagrams to determine which species are common across all regions and which are unique to each region.

#4. Diversity Indices

We will visualize the richness, Shannon and Simpson diversity and the evenness of these communities using diversity profiles. This analysis will be conducting considering communities observed within each region and across intertidal zones. However, revising this analysis to consider a different aspect of the data, i.e. sites within a region, is straightforward process, that can be accomplished using the code below.

Diversity Indices: Regional Communities

Diversity Indices: Intertidal Zones

#5. Introduced Clam Populations

We will explore the diversity and abundance of introduced clam species across the study sites, regions, and intertidal zones. Currently, the data set includes three introduced infaunal bivalves, Mya arenaria, Ruditapes philippinarum, and Nuttallia obscurata. As the introduced species are not present within each region, figures that illustrate each species occurance separately have been added. All figures can easily be updated to include additional species as they are detected.

Diversity and Abundance of Introduced Clam Populations by Site

Diversity and Abundance of Introduced Clam Populations by Region

Abundance of Each Introduced Clam Species

#6. Bivalve Size Distributions We will plot size distribution by species across regions

#7. Bivalve Lengths-Width-Weight Relationships

An example of the relationship between the measurements we have been collecting. This shows a high levels of correlation between measurements. This means that while width and height may be useful for explaining weight, they are likely not needed as their relationship with length is conserved so well that the predict eachother (i.e. co-linearity rarely explains additional variability)

#8. Bivalve Age Distributions

#9. Bivalve Species Detection

We will use rarefaction and extrapolation to determine the number of samples needed to survey bivalve communities. This analysis will focus on identifying the number of quadrats needed to ensure that an each intertidal zone if effectively sampled (i.e. the species present are detected). This framework will also be used to evaluate the differences in methods detection capabilities once data from multiple methods are combined.

Manuscript Figures

This section won’t run anything on the R-Markdown, but it is where the current manuscript figures are being constructed. ## Figure 1: Map and Rarefraction/Extrapolation

Figure 1: Map and detection of species

Figure 2: Diversity/Abundance, Diversity Indices, and Introduced Species

Figure 3: Size Distributions, Length/Width/Weight/Age, and Population Estimates