c14_fix_lab_id: Detect and fix malformed radiocarbon laboratory identifiers

View source: R/c14_lab_id.R

c14_fix_lab_idR Documentation

Detect and fix malformed radiocarbon laboratory identifiers

Description

c14_is_lab_id() tests whether a lab ID matches the conventional format, e.g. "OxA-1234" or "OxA 5678".

c14_fix_lab_id() attempts to coerce malformed lab IDs into this format, by fixing common issues and variant forms.

Usage

c14_fix_lab_id(x)

c14_is_lab_id(x)

Arguments

x

Vector of potentially malformed lab IDs.

Details

The regular expression used to test for the conventional format is "^([[:alpha:]\(\)/]{1,8})[ -\u2010\u2013_#\.\+](.*)$". This accepts unusual but parsable variants such as "Ki(KIEV)-1234" or "Gif/LSN_5678"

Value

c14_is_lab_id() returns a logical vector the same length as x.

c14_fix_lab_id() returns x with values replaced to match the conventional format where possible.

Examples

# Valid formats
c14_is_lab_id(c("OxA-1234", "OxA 1234", "OxA", "Gif/LSN_5678"))

# Invalid formats
c14_is_lab_id(c("1234", "1234-OxA"))

# Fix
c14_fix_lab_id(c("OxA", "Gif/LSN_5678", "Ki(KIEV)-1234"))

joeroe/c14 documentation built on Nov. 24, 2024, 11:47 p.m.