pull_database.Rd
Extraction of
catch data,
weight measurements,
length measurements,
age reads, and
management quantities
from NORPAC and PacFIN databases for the Pacific Hake assessment.
Other, additional, databases may be added in the future through the
database =
argument.
pull_database(
database = c("NORPAC", "PacFIN"),
startyear = list(NORPAC = 2008, PacFIN = c(1980, 2008)),
endyear = hakedata_year(),
passwordfile = "password.txt",
savedir = hakedata_wd()
)
A vector of character strings indicating
which databases you want to pull information from.
Options include c("NORPAC", "PacFIN")
,
one or both (the default) can be specified.
Note that case matters here.
An ordered list the same length as database
with
at least one integer entry per list item specifying the
first year that you want data for.
If only a single value per database is provided, then
then the year will be recycled for catch and composition information.
Otherwise,
the first entry is the start year for catches and
the second is the start year for the biological data.
Names of the list must match entries in database
or be NULL
.
An integer value specifying the final year of data
to include in the extraction. The default uses
hakedata_year()
to determine the terminal year.
A file path directing R to a file that contains
a password for each database listed in database
.
Each password should be on its own line. The default case would place
your NORPAC password on the first line and the
second line would be your PacFIN password without quotes.
If this argument is NULL
, users will be prompted
for their passwords.
Passwords are needed because the databases store confidential data.
A full path to a directory where you want files saved.
The default is to save them in a folder found using hakedata_wd()
,
which returns a path specific to the personal preferences of JTC members.
An environment or list
with several objects pulled from the
NORPAC and PacFIN databases. Several Rdat
files are
saved to the disk in the extractedData folder,
one file for each object and a summary file.
pull_database()
includes several steps, outlined below,
and leads to many files being saved to your computer.
Originally, files were NOT overwritten. In 2022, Kelli F. Johnson
changed the code to not save previous downloads to
save on disk space, reduce the storing of redundant information, and
simplify the code base that needed maintenance.
Find the folder where the data should be saved with hakedata_wd()
.
Extract data from NORPAC.
Catch data
Weight and age data
Squash table of ages (that also includes lengths)
Foreign ages
Species list
Extract data from PacFIN.
Catch data
Age, length, and weight data from bds table
At-sea data
Management quantities such as allowable catch limits (ACL) for the Pacific Fisheries Management Council, i.e., U.S. quantities of interest.
Save each object to the disk in the "extractedData" directory in
hakedata_wd()
.