Performs a series of string normalizations to get a clean shipname or callsign. This was inspired by Jaeyoon Park's Python Module: https://github.com/jaeyoonpark/shipdataprocess.

normalize_shipname will do the following:

  • Make all letters into capital letters

  • Remove leading and trailing whitespaces

  • Remove linebreaks

  • Remove all references to vessel codes (i.e. MFV stands for Marine Fishing Vessel)

  • Convert numbers expressed as letters to numbers (i.e. ONE becomes 1)

  • Convert roman numerals to arabic numbers

  • Remove NO. when it references a number (i.e. BOAT NO.5 becomes BOAT5)

  • Remove all special characters

normalize_callsign will:

  • Make all letters into capital letters

  • Remove leading and trailing whitespaces

  • Remove linebreaks

  • Remove leading zeroes (i.e. 007JAMESBOND becomes 7JAMESBOND)

  • Remove all special characters

normalize_shipname(name, ...)

normalize_callsign(callsign, ...)

normalize_economic_unit(economic_unit, ...)

Arguments

name

A character string (or vector of strings) to be normalized

...

Any other arguments

callsign

A character string (or vector of strings) to be normalized

economic_unit

A character string (or vector of strings) to be normalized

Value

A normmalized shipname or callsign

Examples

# Normalize a shipname that contains special # characters and roman numerals. library(startR) shipname <- "weird-+%()<>$;!&'`#/boat name IV" normalize_shipname(shipname)
#> [1] "WEIRDBOATNAME4"
# Normalize a callsign starting with zeros # and weird characters callsign <- "0020300a-+%()<>$;!&'`#/" normalize_callsign(callsign)
#> [1] "20300A"