get_combined_species: Get combined catch counts for a set of species

View source: R/iphc-data.R

get_combined_speciesR Documentation

Get combined catch counts for a set of species

Description

The .rds file for each species needs to already exist, from running cache_pbs_data_iphc(sp_vec). This combines the values together, for example to give data for a number of skates combined, rather than individual species.

Usage

get_combined_species(
  sp_vec,
  save_RDS_name = NULL,
  path = ".",
  compress = FALSE
)

Arguments

sp_vec

vector of IPHC species names

save_RDS_name

name (with .rds suffix) to save the .rds file of the output (there is no natural obvious default based on sp_vec), if NULL then do not save

path

The folder where the cached data are saved, and the new one will be saved.

compress

Compress the .rds file? Defaults to FALSE for faster reading and writing at the expense of disk space.

Value

list with tibble set_counts (same format as for individual species) that contains year, station name, lat, lon, and

  • E_it - effective skate number for that station, based on all hooks (so NA for 1997-2002, 2013, 2020, 2021, 2022),

  • N_it...NUM - number of 'species' caught on all hooks, so NA for 1997-2002, 2013, 2020, 2021, 2022, where NUM is the column number appended by dplyr within this function,

  • N_it_sum - sum of N_it...NUM, with NA's removed (treated as zeros) TODO: say what happens if some have NA

  • C_it_sum - catch rate of all 'species' as number per effective skate, based on all hooks, so NA for 1997-2002, 2013, 2020, 2021, 2022

  • E_it20 - effective skate number for that station, based on first 20 hooks, so NA for 1995 and 1996,

  • N_it20...NUM number of 'species' caught in first 20 hooks, so NA for 1995 and 1996, where NUM is the column number appended by dplyr within this

  • N_it20_sum - sum of N_it20...NUM, with NA's removed (treated as zeros) TODO: say what happens if some have NA

  • C_it20_sum - catch rate all 'species' as number per effective skate, based on the first 20 hooks, so NA for 1995 and 1996,

  • usable - whether or not that station is usable, as deemed by IPHC,

  • standard - whether or not station is a standard one or in the expansion set after 2018; all Y here since pre-2018; for 1996 and 1997 the station layout is not the standard grid and the naming of stations is different, ⁠intersect(filter(sp_set_counts$set_counts, year == 1996)$station, setDataExpansion$station⁠ is empty, but the area fished is similar to later standard years so we put Y here

If no data on any of the species in sp_vec then C_it_all and N_it are NA's. This happens for sure for years when the counts are not available. Examine each individual species count for NA's to check they have propagated through okay. Also saves the data in path/save_RDS_name.

Author(s)

Andrew Edwards

Examples

## Not run: 
 skate_sp <- c("aleutian skate",
               "big skate",
               "roughtail skate",
               "sandpaper skate",
               "longnose skate",
               "alaska skate")
res <- get_combined_species(sp_vec = skate_sp)
# And see `analysis_for_HG_predators` vignette.

## End(Not run)

pbs-assess/gfiphc documentation built on July 4, 2023, 1:13 p.m.