knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 10, fig.height = 8 )
This vignette extracts, analyses, saves and plots the data for all (>100) species for the
gfsynopsis reports, plus "hooks with bait" considered as a species. It only
runs for users with access to the GFBio database at the Pacific Biological
Station, or if you have the retrieved data cached locally (in default directory
all-species-data/
. Species names are now searchable in the resulting .html
file (that you may well be reading now).
These analyses ignore hook competition, though it is likely important given the final plot of the rate of hooks returned with bait (showing how this jumps around), and given our simulation results in Watson et al. (2023). We are looking at incorporating hook competition in the next groundfish synopsis report.
library(gfiphc)
Define common species name:
sp_vec <- gfsynopsis::get_spp_names() %>% dplyr::arrange(species_code) %>% dplyr::pull(species_common_name) sp_vec <- c(sp_vec, "hook with bait")
Extract the data, create the four time Series A, B, C and D, compare them, and plot the results, for all species (will take some time). Series AB (bottom right panel), if shown, will be the longest time series that can be calculated and will be representative of the full coast (others might be longest for rarer species). If it is empty then one of the other time series is the longest. For rarer species with low catch rates, it may make more sense to consider Series B instead of Series AB.
Change the options to use the cached data and cached results (for example, set
both to FALSE
when first running; can see the files appearing in the cache
folders species by species, took about an hour for 2022 data):
for(sp in sp_vec){ # increment these to test, done up to number shown iphc_get_calc_plot_full(sp, cached_data = TRUE, # TRUE if data already saved cached_results = TRUE, # TRUE if results already saved print_sp_name = TRUE, path_data = "all-species-data", path_results = "all-species-results") }
# For investigating and checking: # If results saved: # series_ABCD_full <- readRDS(paste0("all-species-results/", sp_hyphenate(sp, results = TRUE)))$series_ABCD_full # # Else load data and do calculations: # sp_set_counts <- readRDS(paste0("all-species-data", "/", sp_hyphenate(sp))) # series_ABCD_full <- calc_iphc_full_res(sp_set_counts$set_counts) # # which(sp_vec == sp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.