Skip to contents

This function scrapes MRIP catch data from the MRIP Query tool and saves it as an Rds. Used as a helper function to automate data pulls.

Usage

save_catch(
  this_species,
  this_region,
  out_folder,
  catch_type = "all",
  this_data_type = "numbers of fish",
  wait = TRUE,
  return_fname = TRUE
)

Arguments

this_species

the common name of the species as it appears in the MRIP data. capitalization does not matter.

this_region

the name of the region. Can be a state name, "North Atlantic", "Mid-Atlantic", etc. Capitalization does not matter.

out_folder

where to save the data

catch_type

the type of catch to query. Can be "all" for all catch types (A, B1, B2), or "landings" for just the landings (A and B1). Default is "all".

this_data_type

the type of data to query. Can be any or all of c("numbers of fish", "weight of fish (pounds)", "weight of fish (kilograms)", "mean length", "mean weight"). Default is "numbers of fish".

wait

whether to pause after saving the data. Default is TRUE.

return_fname

whether to return the file name of the saved data. Default is TRUE.

Value

Saves list of the scraped data and metadata. Returns the file name.