swap_site_code: Generate site codes

Description Usage Arguments Details Value Examples

Description

Generates abbreviated site codes from their full names. The codes follow a set pattern designed to be predictable and probably (but not necessarily) unique.

Usage

1
swap_site_code(x, max_length = 4)

Arguments

x

Character vector of site names.

max_length

Numeric. Desired length of the generated codes. Must be greater than 1. Default: 4.

Details

swap_site_code() attempts to generate a fixed-width code consisting of the abbreviation site name and, if present in the site name, a numeric suffix. The pattern is determined by the value of the max_length parameter:

A fixed-width output isn't guaranteed, for example if the name of the site is shorter than max_length.

As long as they are preceded by a space, Roman numerals up to XXXIX (39) are also recognised as a numeric suffix, and are converted to Arabic numbers.

Value

A character vector of site codes derived from x.

Examples

1
2
sites <- c("Çatalhöyük", "Chia Sabz", "Azraq 31", "Gilgal I", "Tell es-Sultan")
swap_site_code(sites)

joeroe/swapdata documentation built on March 26, 2021, 7:47 p.m.