RVdataframe: Formats fishery independent survey data for use in the...

Description Usage Arguments Details Value References See Also

View source: R/RVdataframe.R

Description

This function imports data exported by stratifyBiomass(), adds column YEAR, and binds all years together.

Usage

1
2
3
RVdataframe(path, s.year, e.year, areas = c("shelf", "esswss", "nafo",
  "strat"), lengthbased, qadjusted, update_RV = FALSE, csv = TRUE,
  rdata = TRUE)

Arguments

path

The filepath to the /data folder.

s.year

Year for which to begin data extraction.

e.year

Year for which to end data extraction.

areas

Areas (spatial scales) for which to format data. A separate dataframe will be exported for each area. Options are "shelf", "esswss", "nafo", "strat", or any combination of the four. Default is areas = c("shelf", "esswss", "nafo", "strat").

lengthbased

Logical parameter indicating whether to return stratified length-based data (lengthBased = TRUE) or not length-based data (lengthBased = FALSE).

qadjusted

Logical parameter indicating whether to return q-adjusted biomass and abundance data (qadjusted = TRUE) or not q-adjusted biomass and abundance data (qadjusted = FALSE). q-adjustments are applied at the set level.

update_RV

Logical parameter indicating whether to run extractRV(). Extracting the abundance and biomass data for all years and areas is time consuming, so if data is already extracted, use the default update_biomass = FALSE. If update_RV = TRUE, user must define channel in the global environment (see Details).

csv

Logical value indicating whether to export dataframe as a .csv file. Default is csv = TRUE.

rdata

Logical value indicating whether to export dataframe as a .RData file. Default is rdata = TRUE.

Details

If update_RV = TRUE, user must define channel = odbcConnect("ptran", uid = ###, pwd = ###) in the global environment. This channel must have access to the gscat, gsdet, gsinf, and gs_lengths tables from the groundfish database and the nafo_strat table from the mfd_stomach database.

Value

This function creates a directory path/output/RV/area for each entry in area. In each area folder is a csv and/or RData file for the specified combination of lengthbased and qadjusted (object name RVdata). These files are formatted for the marindicators package.

If lengthbased = TRUE, then RVdata has 6 columns: YEAR, SPECIES, ID, LENGTH (cm), BIOMASS (kg), and ABUNDANCE (numbers).

If lengthbased = FALSE, then RVdata has 5 columns: YEAR, SPECIES, ID, BIOMASS (kg), and ABUNDANCE (numbers).

References

Original code by DD.

See Also

Other RV functions: biomassData, extractRV, qBiomass, stratifyBiomass, vesselCorr


dempseydanielle/SSdata documentation built on May 3, 2020, 5:09 p.m.