get_lc_call_first_letter: Get the first letter of LC Call Number

View source: R/call-numbers-and-subject.R

get_lc_call_first_letterR Documentation

Get the first letter of LC Call Number

Description

Takes a string representation of a Library of Congress call number and returns the first letter if and only if the LC Call Number is valid

Usage

get_lc_call_first_letter(x, allow.bare = FALSE)

Arguments

x

A Library of Congress call number (string)

allow.bare

A logical indicating whether an LC Call with only the letters should be considered valid (default is FALSE)

Value

Returns first letter or NA if invalid

Examples


get_lc_call_first_letter("Q172.5.E77")
# Q
get_lc_call_first_letter("AF172.5.E77")
# NA

# vectorized
get_lc_call_first_letter(c("Q 172.5", "AF172", "PR6023.A93"))
# Q NA P


libbib documentation built on Nov. 10, 2022, 6:16 p.m.