iphc_get_calc_plot_full: Get data, do calculations and plot Series A, B and longest...

View source: R/calc-iphc-ser.R

iphc_get_calc_plot_fullR Documentation

Get data, do calculations and plot Series A, B and longest series possible (usually Series AB) for the IPHC survey, and maybe save results

Description

Get data, do calculations and plot longest series for the IPHC survey for a given species. For species that have several years of zero catches, Series B may be better to use (but shorter) than Series AB because all hooks were counted. For example Walleye Pollock in 2016 – see example.

Usage

iphc_get_calc_plot_full(
  sp,
  cached_data = TRUE,
  cached_results = FALSE,
  verbose = FALSE,
  print_sp_name = TRUE,
  path_data = ".",
  path_results = NULL
)

Arguments

sp

Species names (as used in gfdata and gfplot). Or something like "skates combined" – see vignette.

cached_data

if TRUE then use cached data (path_data/sp-name.rds)

cached_results

if TRUE then use cached results (path_results/sp-name-results.rds), else do calculations here and save results

verbose

if TRUE then print out some of the data (useful in vignette loops)

print_sp_name

if TRUE then print out species name (useful in vignette loops)

path_data

path to save or load the cached data

path_results

path to save or load the cached data

Details

Will take a while since queries GFbio (and need to be on DFO network). Basically a wrapper for the calculations in the vignette data_for_one_species. Based on iphc_get_calc_plot_area(). See gfsynopsis::iphc_get_calc_plot() for function for gfsynopsis reports. Calling this one iphc_get_calc_plot_full() to distinguish it.

Value

Saves results in path_results/species-name-results.RDS. If path_results is NULL then do not save. For the given species, return list containing

sp_set_counts: list with one element (for consistency), a tibble set_counts (the .RDS file saved when doing cache_pbs_data_iphc(sp)).

ser_ABCD_full: list of output from calc_iphc_full_res() from doing all calculations.

Author(s)

Andrew Edwards

Examples

## Not run: 
iphc_get_calc_plot_full("redbanded rockfish", cached_data = FALSE) # only at PBS
# Example where longest series may not be the most useful since only looking
  at first 20 hooks gives all zeros in 2016, but looking at all hooks gives
  some non-zero sets. In practice, catches may be too sparse to be useful anyway.
x <- iphc_get_calc_plot_full("walleye pollock", cached = FALSE) # only PBS
filter(x$series_ABCD_full$ser_longest, year == 2016)
# A tibble: 1 x 8
  year  Sets num_pos20 I_t20SampleMean I_t20BootMean I_t20BootLow I_t20BootHigh
 <dbl> <int>     <int>           <dbl>         <dbl>        <dbl>         <dbl>
  2016   132         0               0             0            0             0
... with 1 more variable: I_t20BootCV <dbl>
filter(x$series_ABCD_full$ser_all$ser_B, year == 2016)
# A tibble: 1 x 8
   year  Sets num_pos I_tSampleMean I_tBootMean I_tBootLow I_tBootHigh I_tBootCV
  <dbl> <int>   <int>         <dbl>       <dbl>      <dbl>       <dbl>     <dbl>
1  2016   132       2       0.00252     0.00249          0     0.00629     0.719

## End(Not run)

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