This function determines the qualifying "fleet" for CPUE analyses. It is meant to be used with modern data available at the fishing event level.
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")
dat | An input data frame from |
---|---|
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
|
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
|
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 |
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. |
# NOT RUN { d <- get_cpue_index(gear = "bottom trawl") walleye <- tidy_cpue_index(d, "walleye pollock", area_grep_pattern = "5[CDE]+") # }