LWdataframe: Formats length-weight data for use in the 'marindicators'...

Description Usage Arguments Details Value References See Also

View source: R/LWdataframe.R

Description

This function imports data from path/data/lenwgt adds column YEAR, and attaches labels for the spatial scales of interest (shelf, ESS/WSS, NAFO divisions, and/or strata) in column ID.

Usage

1
2
LWdataframe(path, s.year, e.year, areas = c("shelf", "esswss", "nafo",
  "strat"), update_LW = FALSE, csv = TRUE, rdata = TRUE)

Arguments

path

The filepath to the data folder created by extractLW().

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").

update_LW

Logical parameter indicating whether to run extractLW(). This can be time consuming, so if LW data is already extracted, use the default update_LW = FALSE. If update_LW = 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_LW = TRUE, user must define channel = odbcConnect("ptran", uid = ###, pwd = ###) in the global environment. This channel must have access to the gsinf and gsdet tables from the groundfish database.

Value

This function creates a directory path/output/LengthWeight and stores the length-weight dataframe for each area in area_LengthWeight.RData (object name is lw) and/or area_LengthWeight.csv. The dataframe has 5 columns: ID, YEAR, SPECIES, LENGTH (cm), and WEIGHT (g). These files are formatted for the marindicators package.

References

Original code by DD.

See Also

Other LW functions: extractLW, plot_LW


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