Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Read GADM file.
map <- readRDS( file = "USA_adm1.rds" )
# Create Data Frame from spatial object.
map <- fortify( map, region = "NAME_1")
# Create new state column without any special characters.
map$state <- stringi::stri_trans_general( str = map$id
, id = "Latin-ASCII"
)
# Remove Alaska and Hawaii
map <- map[ ! map$state %in% c( "Alaska", "Hawaii" ), ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment