I have been having a lot of fun exploring choroplethr
package created by Ari Lamstein and even made a census Shiny app.
Its time to put this skill in practice. Today I’m going to use R to understand demographics of the state of Maine, the city of Portland, and zipcode of 04101.
First, have a look the state data, head only.
So, what is the population of Maine?
Let’s make a boxplot to see the distribution of population in the US, and where is Maine’s position.
The median population of a state in the US is over 4.3 million, 3 times of Maine’s population. And Maine’s population is less than the first quartile value. This indicates that about 75% of states have a population more than Maine’s, or about 25% of states have a population less than Maine’s.
Here you go. Now We can see which states are the most/least populated.
I think I like this color and scale better.
Let me drill down to some other interesting facts.
The income per capita in Maine is $26824. and how is it to compare with the other states?
Not bad, almost in the middle.
How about the percentage of white population?
Seems Maine is among the whitest states in the nation (caucasian population at 94%). Wikipedia says that Maine has the highest percentage of French Americans among American states and most of the French in Maine are of Canadian Origin and they came from Quebec as immigrants between 1840 and 1930. Interesting.
Now, how about county, or city?
After a quick google search, I found Portland Maine belongs to Cumberland County, the FIPS code for Cumberland County is 23005.
So the population of Cumberland County is:
A little over 282,000.
It’s hard to compare all counties across the US, because there are so many outliers(counties with extreme large population).
The national map does not tell us good story anymore, because there are so many counties. Let’s zoom in.
Apparently, Cumberland is the most populated county in Maine.
What is the median rent in Cumberland? And how is it to compare with other counties?
Oh no, Cumberland county has one of the highest median rent, people who live there must be well off!
Now let’s drill down even further to the zipcode.
What is the population of the zip code 04101?
It turns out, zip 04101 area is among the most populated zip areas in Maine. However, the most popuated zip area in Maine has 45087 people.
Let’s zoom in to the county level for the zipcode.
Still, zip 04101 area is one of the most populated zip areas in Cumberland county, and the most populated zip area in the county has 30639 people.
Let’s explore more details on the demographics of this zip area.
The income per capita in this zip area is $24560. Let’s see what that means.
Can anyone draw any inference from this map? It seems the highest income per capita in the county is a lot more than $60K, and lowest much below $20K.
According to above maps, I’m already jealous of people who live in Portland Maine.
The souce code used to create this blog can be found here.