openintro (version 1.7.1)

abbr2state: Convert state names to abbreviations and back again

Description

Two utility functions. One converts state names to the state abbreviations, and the second does the opposite.

Usage

abbr2state(abbr)

state2abbr(state)

Arguments

state

A vector of state name, where there is a little fuzzy matching.

abbr

A vector of state abbreviation.

Value

Returns a vector of the same length with the corresponding state names or abbreviations.

See Also

county, countyComplete

Examples

Run this code
# NOT RUN {
state2abbr("Minnesota")
abbr2state("MN")

#_____ Some Spelling/Capitalization Errors Okay _____#
state2abbr("mINnesta")
# }

Run the code above in your browser using DataLab