Convert station names or trip codes to three-letter station codes. Useful for standardising location identifiers in datasets that use full names or for extracting station information from trip codes.
Details
Station Name Conversion
The function converts full names to three-letter codes:
"Darwin" →
DAR"Yongala" →
YON"North Stradbroke Island" or "North Stradbroke" →
NSI"Port Hacking" →
PHB"Maria Island" →
MAI"Kangaroo Island" →
KAI"Esperance" →
ESP"Rottnest Island" →
ROT"Ningaloo" →
NIN"Bonney Coast" →
VBM"Southern Ocean Time Series" →
SOTS
See also
pr_add_StationName()for the reverse conversionpr_get_info()for station metadatapr_get_trips()which returns data with trip codes
Examples
# Add station codes from station names
df <- data.frame(StationName = c("Port Hacking", "Maria Island")) %>%
pr_add_StationCode()
# Extract station codes from trip codes
df <- data.frame(TripCode = c("PHB20220101", "MAI20220115")) %>%
pr_add_StationCode()