abbr_to_name: Get state names from state abbreviations

View source: R/utils.R

abbr_to_nameR Documentation

Get state names from state abbreviations

Description

Look up state names by state abbreviations (including District of Columbia and Puerto Rico); this function is based on grep(), and hence allows for regular expressions.

Usage

abbr_to_name(
  abbr,
  ignore.case = FALSE,
  perl = FALSE,
  fixed = FALSE,
  ties_method = c("first", "all")
)

Arguments

abbr

Vector of state abbreviations to look up.

ignore.case, perl, fixed

Arguments to pass to grep(), with the same defaults as in the latter function. Hence, by default, regular expressions are used; to match against a fixed string (no regular expressions), set fixed = TRUE.

ties_method

If "first", then only the first match for each name is returned. If "all", then all matches for each name are returned.

Value

A vector of state names if ties_method equals "first", and a list of state names otherwise.

See Also

name_to_abbr()

Examples

abbr_to_name("PA")
abbr_to_name(c("PA", "PR", "DC"))


covidcast documentation built on July 26, 2023, 5:29 p.m.