README.md

SQOUnified R Package

The SQOUnified R package provides a suite of tools for assessing sediment quality based on multiple lines of evidence, including benthic indices, chemistry, and toxicity. The package integrates these assessments into a comprehensive site evaluation according to Sediment Quality Objectives (SQO).

This is based on the California Sediment Quality Objectives (CASQO) Technical Manual

Installation

To install the SQOUnified package, you can use the devtools package. Ensure all dependencies are installed beforehand.

# Install necessary dependencies
install.packages(c("dbplyr","reshape2","vegan","dplyr","plyr","purrr","stringr","tidyr"))

# Install the package using devtools
devtools::install_github("SCCWRP/SQOUnified")

The package also comes with example data sets which are available when the package is loaded

# load the package
library(SQOUnified)

# package comes with sample data
# the dataframes are called 'benthic_sampledata', 'chem_sampledata', and 'tox_sampledata'
SQOUnified(benthic = benthic_sampledata, chem = chem_sampledata, tox = tox_sampledata)

### Other misc examples:
# Benthic integrated SQO (returns all individual indices as well)
benthic.sqo(benthic_sampledata)

# Tox summary
tox.summary(tox_sampledata)

# Tox integrated SQO Score
tox.sqo(tox_sampledata)

# Chemical Score Index
CSI(chem_sampledata)

# Chemistry Integrated SQO Score
chem.sqo(chem_sampledata)

Usage

Input Data Requirements for Benthic, Chemistry, and Toxicity Functions

1. Input Data for benthic functions (benthic.sqo, BRI,RBI,IBI,RIVPACS,MAMBI)

The benthic functions require a dataframe with the following columns:

2. Input Data for chemistry functions (chem.sqo, chemdata_prep, CSI, LRM)

The chemistry functions require a dataframe containing:

Notes: - Non-detect values should be marked as -88. - All measurements should be expressed on a dry-weight basis: metals in mg/dry kg and organic compounds in ug/dry kg.

3. Input Data for toxicity functions (tox.sqo, tox.summary)

The toxicity functions require a dataframe containing:

All Package Functions

Below we will list all the functions of the SQOUnified package, grouped into 4 sections - SQOUnified - Toxicity - Chemistry - Benthic

SQOUnified Function

The primary function SQOUnified computes integrated sediment quality scores based on various lines of evidence: benthic, chemistry, and toxicity data. It requires input data for each category and outputs an integrated assessment.

Example Usage:

# Load the package
library(SQOUnified)

# Example data files
benthic_data <- read.csv("path/to/your/benthic_data.csv")
chem_data <- read.csv("path/to/your/chem_data.csv")
tox_data <- read.csv("path/to/your/tox_data.csv")

# Run the function
result <- SQOUnified(benthic = benthic_data, chem = chem_data, tox = tox_data)
print(result)

Parameters

The function will compute and log the results for each of these inputs, generating an integrated score based on the criteria defined in the package. The output dataframe also includes all individual scores and indices: - Integrated Chemistry Score - CSI - LRM - Integrated Toxicity Score - (Results from all the tox endpoint tests in the data, typically 'Mytilus NormDev' and 'Eohaustorius Survival') - Integrated Benthic Score - BRI - RBI - IBI - RIVPACS - MAMBI (Not used for calculation of SQO Score)

Toxicity Functions

tox.sqo

The tox.sqo function assesses sediment toxicity by analyzing toxicity test results.

Usage:

tox_results <- tox.sqo(tox_data)

tox.summary

The tox.summary function provides a summary of the toxicity results for easier interpretation and reporting.

Usage:

tox_summary <- tox.summary(tox_data)

Chemistry Functions

chem.sqo

The chem.sqo function evaluates the chemical condition of sediments using specific chemical metrics.

Usage:

chem_results <- chem.sqo(chem_data)

chemdata_prep

The chemdata_prep function reformats/prepares the data for getting the SQO score for the chemistry LOE

Usage:

chem <- chemdata_prep(chem_data)

NOTE: When you put your raw chemistry data in the chemistry functions, this chemdata_prep function is called from within, so no need to preprocess the data before so long as it has those required columns

CSI

The CSI function calculates the Chemical Score Index for the input chemistry data

Usage:

csi.results <- CSI(chem_data)

LRM

The LRM function calculates the Chemical Score Index for the input chemistry data

Usage:

lrm.results <- LRM(chem_data)

Benthic Functions

benthic.sqo

The benthic.sqo function computes benthic indices to evaluate the biological condition of the sediments.

Usage:

benthic_results <- benthic.sqo(benthic_data)

benthic.sqo

The benthic.sqo function computes benthic indices to evaluate the biological condition of the sediments.

Usage:

benthic_results <- benthic.sqo(benthic_data)

NOTE: It will be the same for each of the benthic functions - BRI, RBI, IBI, RIVPACS and MAMBI

Example Workflow

Here’s how you can use the SQOUnified package to perform a complete sediment quality assessment:

# Load sample data
benthic_data <- read.csv("path/to/benthic_data.csv")
chem_data <- read.csv("path/to/chem_data.csv")
tox_data <- read.csv("path/to/tox_data.csv")

# Calculate individual SQO components, if you would like
benthic_results <- benthic.sqo(benthic_data)
chem_results <- chem.sqo(chem_data)
tox_results <- tox.sqo(tox_data)

# Get the tox summary table, on its own, if you would like
tox_summary <- tox.summary(tox_data)

# Compute the integrated SQO scores - a dataframe with all scores, including the overall site assessments
integrated_result <- SQOUnified(benthic = benthic_data, chem = chem_data, tox = tox_data)

# View the results
print(integrated_result)

Contributing

Contributions to SQOUnified are welcome, however, if you come across issues using the package, it would be preferable for one to submit an issue rather than a pull request in most cases. If you have a request for a feature(s) then please do not hesitate at all to post an issue.



SCCWRP/SQOUnified documentation built on Nov. 3, 2024, 12:54 a.m.