R365: Day 16 – Cities in Maps

R365: Day16 – Cities in Maps
 I wanted to revisit the {maps} package again, it had a lot of data inside that I feel like I was completely unaware of. R keeps a list of major (40K+) cities in each of the US states as well as major world cities as part of its us.cities and world.cities portion of {maps}.
 For example, here are all of the cities in California with a population over 150K
 map.cities(us.cities, country="CA",minpop=150000)
and US cities with populations over 1M
 map("state", interior = FALSE)
 map("state", boundary = FALSE, lty = 5, add = TRUE)
 map.cities(us.cities,minpop=1000000, label=TRUE)

What I really want to do is to color in the states using if/then/else statements, but I cant figure out how to do that right now. Maybe tomorrow!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s