Skip to contents

Reconciles ship codes between datasets using exact matching on ship_nodc and ship_name, followed by word-overlap fuzzy matching against CalCOFI UNOLS, NODC WOD, and optionally ICES reference sources. Manual overrides can be provided via a CSV file.

Usage

match_ships(
  unmatched_ships,
  reference_ships,
  ship_renames_csv = NULL,
  fetch_ices = TRUE
)

Arguments

unmatched_ships

tibble with columns: ship_code, ship_name (ships needing reconciliation from bottle casts)

reference_ships

tibble with columns: ship_key, ship_nodc, ship_name (known ships from swfsc database)

ship_renames_csv

optional path to manual overrides CSV with columns: csv_name, csv_code, csv_name_new, csv_code_new

fetch_ices

logical; if TRUE, also query ICES ship API (default TRUE)

Value

tibble with match results: ship_code, ship_name, match_type, matched_ship_key, matched_ship_nodc, matched_ship_name, confidence

Details

Adapted from the ship reconciliation pattern in workflows/ingest_calcofi.org_bottle-database_0.qmd (lines 117-260).

Examples

if (FALSE) { # \dontrun{
unmatched <- tibble(ship_code = "325S", ship_name = "RV BELL M SHIMADA")
reference <- tibble(ship_key = "3322", ship_nodc = "3322",
  ship_name = "BELL M. SHIMADA")
matches <- match_ships(unmatched, reference)
} # }