I have a geojson file of state boundaries that I obtained from here. In particular I'm using the 20m US States Data
I'm trying to subset the data so that I can use leaflet to map only certain states. I can subset a single state using:
states <- geojsonio::geojson_read("gz_2010_us_040_00_20m.json", what = "sp")
az <- subset(states, NAME == "Arizona")
This method does not seem to work for selecting multiple states though:
swStates <- subset(states, NAME == c("Arizona", "Nevada", "New Mexico"))
Selecting multiple states usually results in only one or two states being selected, or none at all. Is there a different method I can use to subset this data?