benthic_query: Pull the necessary benthic data from SCCWRP database to...

View source: R/benthic_query.R

benthic_queryR Documentation

Pull the necessary benthic data from SCCWRP database to compute SQO Benthic indices.

Description

This function is to be used internally at SCCWRP. The naming of the tables is based on how we named tables in our own database. Notice that any IP addresses, passwords, usernames for a DB Connection must be entered manually.

When this function is run, the latest and greatest benthic data will be pulled in, and a dataframe will be returned. It will also query the grabevent, field assignment, and station occupation table for other necessary information, such as LatLongs, or Salinity.

The function returns a dataframe that can be plugged into any of the benthic functions: RBI, BRI, IBI, RIVPACS, MAMBI, benthic.sqo, and SQOUnified.

Usage

benthic_query(db_connection = NULL)

Arguments

db_connection

- a DBI database connection object, created with the DBI::dbConnect function https://db.rstudio.com/getting-started/connect-to-database/

If the function is run with no arguments, user will be prompted for database connection information. hostname or IP, username, password, and database name.

Value

benthic_data - a dataframe with the following columns

StationID - an alpha-numeric identifier of the location;

Replicate - a numeric identifying the replicate number of samples taken at the location;

SampleDate - the date of sample collection;

Latitude - latitude in decimal degrees;

Longitude - longitude in decimal degrees. Make sure there is a negative sign for the Western coordinates;

Species - name of the fauna, ideally in SCAMIT ed12 format, do not use sp. or spp., use sp only or just the Genus. If no animals were present in the sample use NoOrganismsPresent with 0 abundance;

Abundance - the number of each Species observed in a sample;

Salinity - the salinity observed at the location in PSU, ideally at time of sampling.

Stratum - the stratum of the station (e.g. Port, Bay, Estuary, etc)

Exclude - To be completely honest, I don't know what this means. You'd have to ask Joana or David Gillett.


SCCWRP/SQOUnified_archive documentation built on March 30, 2022, 12:14 a.m.