Week 3: Exploring Gapminder Data through Maps

Data and Computing Fundamentals

Exercise 1

Make a world map in which the population of each country is indicated by a color.

pop = fetchGapminder("Gapminder/TotalPopulation.csv")
## Retrieving from
## http://www.mosaic-web.org/go/datasets/Gapminder/TotalPopulation.csv
Popul = subset(pop, Year == 2010)
mWorldMap(Popul)
## Loading required package: manipulate
## Warning: there is no package called 'manipulate'
## Error: could not find function "error"

Manipulate to get desired variable

Exercise 2

Make a world map in which the population of each country is indicated by the size of a circle.

Same as above, but check box that says use bubbles

Exercise 3

Make a world map in which the population density of each country is indicated by a color.

“{r
area = fetchGapminder("Gapminder/LandArea.csv”)
join(pop, area)
area1 = subset(both, Year==2010)
transform(area1, Density = TotalPopulation/LandArea)
mWorldMap(area1)


Then manipulate to get desired variable

#### Exercise 4

Make a map, like this, that correlates traffic deaths with fraction of roads that are paved.  (See `PavedRoads.csv` in the Gapminder data.)


Retrieving from

http://www.mosaic-web.org/go/datasets/Gapminder/TrafficDeathRate.csv


Retrieving from

http://www.mosaic-web.org/go/datasets/Gapminder/PavedRoads.csv


Joining by: Country


201 codes from your data successfully matched countries in the map

12 codes from your data failed to match with a country code in the map

42 codes from the map weren't represented in your data


![plot of chunk unnamed-chunk-3](figure/unnamed-chunk-3.png) 


* What sort of correlation is there between fraction of roads paved and traffic death rates?
Seems that higher paved road fraction is correlated with a lower traffic death rate.
* Are there countries that stand out of the trend?  Which ones
Lithuania and Latvia seem to have exceptionally high traffic death rates given their fraction of paved roads.

Make a scatter plot of the traffic death rate, fraction of paved roads, and alcohol consumption per capita.  Compare the map portrayal to the scatter plot --- which one makes it easier to see various patterns.

The map is much easier.