c14_parse_lab_id: Parse radiocarbon laboratory identifiers

View source: R/c14_lab_id.R

c14_parse_lab_idR Documentation

Parse radiocarbon laboratory identifiers

Description

Splits a vector of radiocarbon lab IDs (e.g. "OxA-1234") into its constituent parts: the lab code ("OxA") and quasi-numeric unique identifier ("1324"). If x contains values that don't fit the standard format ("OxA-1234" or "OxA 4567"), by default the function will attempt to fix these with c14_fix_lab_id() before parsing.

Usage

c14_parse_lab_id(x, fix = TRUE)

Arguments

x

Vector of lab IDs, e.g. "OxA-1234".

fix

If TRUE (the default), attempts to fix malformed lab IDs before parsing.

Value

A data frame with two character columns: lab_code and lab_number. If x is of length one, this is simplified to a named character vector of length 2.

Examples

c14_parse_lab_id(c("OxA-1234", "Ly 456", "RT 1234-5678"))

# By default, tries to fix malformed values of x before parsing
# Use fix = FALSE for strict parsing
c14_parse_lab_id(c("OxA 1234", "OxA_5678", "Gif/LSN-123"))
c14_parse_lab_id(c("OxA 1234", "OxA_5678", "Gif/LSN-123"), fix = FALSE)

# Single values of x are simplified to a character vector
c14_parse_lab_id("OxA 1234")

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