swap_control_site_name: Control site names

Description Usage Arguments Details Value Examples

View source: R/control.R

Description

This function ensures site names conform to a controlled vocabulary. It compares a vector of names to a thesaurus of variant names, misspellings and character encoding inconsistencies and replaces matches with a canonical form.

Usage

1

Arguments

x

Character vector of site names.

quiet

Logical. If TRUE, suppresses messages about replaced values. Default: FALSE.

Details

Elements of x are matched to the site name thesaurus using the following rules (in order of priority):

  1. Exact match to a variant name in the thesaurus

  2. Plain text match to a thesaurus variant, allowing for substitution or omission of non-ASCII characters (e.g. "Catalhoyuk" → "Çatalhöyük"), punctuation (e.g. "Baja" → "Ba'ja"), or whitespace (e.g. "El-Wad" → "El Wad").

Ambiguous site names—elements of x that match multiple thesaurus entries— will cause an error.

Value

x with elements matched to the thesaurus replaced by their canonical forms.

Unless quiet = TRUE, the function also prints a list of values that were changed. A warning will be issued if elements of x were not matched to the thesaurus (regardless of the quiet argument).

Examples

1
2
sites <- c("Catalhoyuk", "Tepe Ganj Dareh", "Jericho")
swap_control_site_name(sites)

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