tidy_cpue_index: Tidy commercial PBS CPUE data

View source: R/tidy-cpue-index.R

tidy_cpue_indexR Documentation

Tidy commercial PBS CPUE data

Description

This function determines the qualifying "fleet" for CPUE analyses. It is meant to be used with modern data available at the fishing event level.

Usage

tidy_cpue_index(
  dat,
  species_common,
  year_range = c(1996, as.numeric(format(Sys.Date(), "%Y")) - 1),
  alt_year_start_date = "04-01",
  use_alt_year = FALSE,
  lat_range = c(48, Inf),
  min_positive_tows = 100,
  min_positive_trips = 5,
  min_yrs_with_trips = 5,
  area_grep_pattern = "5[CDE]+",
  lat_band_width = 0.1,
  depth_band_width = 25,
  clean_bins = TRUE,
  depth_bin_quantiles = c(0.001, 0.999),
  min_bin_prop = 0.001,
  lat_bin_quantiles = c(0, 1),
  gear = "bottom trawl",
  return_raw_data = FALSE
)

Arguments

dat

An input data frame from gfdata::get_cpue_index().

species_common

The species common name.

year_range

The range of years to include.

alt_year_start_date

Alternative year starting date specified as a month-day combination. E.g. "03-01" for March 1st. Can be used to create 'fishing years'.

use_alt_year

Should the alternate year (e.g. fishing year) column alt_year be used? If FALSE then the calendar year will be used. If this is set to TRUE then the year column will be replaced with the alt_year column.

lat_range

The range of latitudes to include.

min_positive_tows

The minimum number of positive tows over all years.

min_positive_trips

The minimum number of annual positive trips.

min_yrs_with_trips

The number of years in which the min_positive_trips criteria needs to be met.

area_grep_pattern

A regular expression to extract the management areas of interest.

lat_band_width

The latitude bandwidths in degrees.

depth_band_width

The depth band widths in m.

clean_bins

Logical. Should the depth and latitude bands be rounded to the nearest clean value as defined by lat_band_width or depth_band_width? Internally, these use, for example: gfplot:::round_down_even(lat_range[1], lat_band_width).

depth_bin_quantiles

Quantiles for the depth bands. If the cumulative proportion of positive fishing events within a given depth bin is less then the lower amount or greater than the upper amount then that depth bin will be dropped.

min_bin_prop

If the proportion of fishing events for any given factor level is less than this value then that factor level will be dropped.

lat_bin_quantiles

Quantiles for the latitude bands. Values above and below these quantiles will be discarded.

gear

One or more gear types as a character vector.

Examples

## Not run: 
d <- gfdata::get_cpue_index(gear = "bottom trawl")
walleye <- tidy_cpue_index(d, "walleye pollock",
  area_grep_pattern = "5[CDE]+"
)

## End(Not run)


seananderson/pbs-synopsis documentation built on April 4, 2024, 1:36 p.m.