Pull catch data from the Comprehensive Fish Ticket table in PacFIN.

PullCatch.PacFIN(
  pacfin_species_code,
  council_code = "P",
  username = getUserName("PacFIN"),
  password = ask_password(),
  savedir = getwd(),
  addnominal = TRUE,
  verbose = TRUE
)

Arguments

pacfin_species_code

A vector of strings specifying the PacFIN species code(s) you are interested in. This has sometimes been referred to as "SPID" in legacy sql scripts. An example for sablefish would be pacfin_species_code = "SABL". Lists of species codes in hierarchical order, by organization, and alphabetically organized can be found on the PacFIN website. Often you will want to include nominal species categories. Where, nominal (i.e., existing in name only) means information for a given species that is "derived" from non-species specific information, e.g., species complexes that are split out by species compositions like "nominal aurora rockfish" which would be ARR1. For some functions, these nominal categories can automatically be added, see the argument addnominal.

council_code

A vector of character strings specifying the council code that you wish to retain data for. The default "P" means data will only be returned for the Pacific Fisheries Management Council. Other accepted values are "N" or "*".

username

Most often, this is a string containing your username for the database of interest. You can use getUserName() if you prefer to not enter this argument and assume the default search and/or rules for finding your username will work. This is the default behavior if you leave username as a missing argument, i.e., username <- getUserName(database = database). Sometimes this search will fail because of legacy rules, which are unknown to the development team, that were used to create your username. Please email the maintainer of this package if you need more functionality here.

password

Most often, this is a string containing your password for the database of interest. You can use the function ask_password() if you would prefer to be prompted for your password. Please do not share this password with anyone or push code to a repository that has your password saved in it.

savedir

A file path to the directory where the results will be saved. The default is the current working directory. The path can be relative or absolute.

addnominal

A logical, where the default, TRUE, adds nominal PacFIN species code to pacfin_species_code. FALSE leaves pacfin_species_code as input by the user, which will miss catch for species such as dover sole that have more than one species code within PacFIN, e.g., pacfin_species_code = c("DOVR", "DVR1"). Users can also input a vector to pacfin_species_code if you want to specify the species and the nominal species code without searching for it. This is helpful for when you are getting data for two species and you only want nominal catch for one or if you only wanted nominal catch. Nominal species code will be searched for using PullNominal.PacFIN() if the input value for addnominal is TRUE.

verbose

A logical specifying if output should be written to the screen or not. Good for testing and exploring your data but can be turned off when output indicates information that you already know. The printing of output to the screen does not affect any of the returned objects. The default is to always print to the screen, i.e., verbose = TRUE.

Value

A .RData file is saved with the object inside the file stored as catch.pacfin. This same data frame is also returned invisibly.

Details

Species with special considerations

URCK

There is a rockfish (URCK) category that consists of unassigned rockfish landings. The majority of the catch is prior to 2001. Currently, there is no agreed upon methodology to parsed these landing out to specific rockfish species. At present, landings in this category are not included in species-specific rockfish catch pulls.

POP

In PacFIN there are four species code that can be associated with Pacific ocean perch. These are POP, POP1, POP2, UPOP. The POP1 is general shelf/slope rockfish and not Pacific ocean perch specific landings. These records occur only in Oregon. As of the 2017 assessment, these records should be removed from the catch file.

Searching for species

Values passed to pacfin_species_code are searched for in their exact form. That is, there are no regular expression searches so mistakes such as " POP" will not be found. In my experiences these mistakes in the species codes are more common for PacFIN species codes that are three letters rather than the standard four letters.

See also

Author

Kelli F. Johnson

Examples

if (FALSE) { # \dontrun{
catch.pacfin <- PullCatch.PacFIN("PTRL")
# Check for confidentiality by year
# though you would also want to do this by your gear types
dplyr::group_by(catch.pacfin, LANDING_YEAR) %>%
  dplyr::summarize(count = dplyr::n_distinct(VESSEL_ID)) %>%
  dplyr::filter(count < 4)

# look for foreign landings
catch.pacfin <- PullCatch.PacFIN("PTRL", council_code = c("*", "N"))
# Counts of NROW() by area code(s)
dplyr::group_by(catch.pacfin, ORIG_PACFIN_CATCH_AREA_CODE) %>%
  dplyr::count()
} # }