Get USA State Name & Abbreviation in R (2 Examples)

In this post, I’ll show how to get a USA state name and abbreviation in the R programming language.

Example 1: Get State Name from State Abbreviation[grep("CA",]            # Convert abbreviation to name
# [1] "California"

Example 2: Get State Abbreviation from State Name[grep("California",]    # Convert name to abbreviation
# [1] "CA"

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed