Download and parse NMD data for the BioticExplorer database
Source:R/downloadDatabase.R
downloadDatabase.RdDownloads annual NMD data from the API and writes them as a DuckDB database
Usage
downloadDatabase(
years,
connection,
icesAreas = NULL,
cruiseSeries = NULL,
gearCodes = NULL,
taxaList = NULL,
overwrite = FALSE
)Arguments
- years
Vector of integers specifying the years to be downloaded. The database reaches 1914:year(Sys.Date())
- connection
Object defining the duckdb connection. Typically made within
compileDatabase.- icesAreas
ICES area shape
st_polygonabject. Used for calculating the ICES area for a specific fishstation.- cruiseSeries
a data.table object of NMD cruise series list. Used to identify cruise series of a specific mission. See
prepareCruiseSeriesList.- gearCodes
a data.table object of NMD gear code list. Used to make gearname and gearcategory columns. See
prepareGearList.- taxaList
a data.table object of NMD taxa reference data. Written to the
taxaindexDuckDB table. SeeprepareTaxaList.- overwrite
Logical indicating whether requested years and reference tables already present in the duckdb database should be downloaded again and replaced. Existing annual rows are deleted transactionally before replacement, so they are not duplicated.
Value
Called for its side effects: appends parsed Biotic data to the DuckDB database. Returns NULL invisibly.