Exercises for Week 3

Anna Trier

Data and Computing Fundamentals

Narrow Data Exercises

In the Gapminder\TotalPopulation.csv data …

I spent my two hours trying to understand the material and concept of narrow and wide. I am still very confused and this is as far as I got

Totpop = fetchData("Gapminder/TotalPopulation.csv")
## Retrieving from
## http://www.mosaic-web.org/go/datasets/Gapminder/TotalPopulation.csv
nrow(Totpop)
## [1] 260
names(Totpop)
##   [1] "Total.population" "X1700"            "X1730"           
##   [4] "X1750"            "X1785"            "X1786"           
##   [7] "X1787"            "X1788"            "X1789"           
##  [10] "X1790"            "X1791"            "X1792"           
##  [13] "X1793"            "X1794"            "X1795"           
##  [16] "X1796"            "X1797"            "X1798"           
##  [19] "X1799"            "X1800"            "X1801"           
##  [22] "X1802"            "X1803"            "X1804"           
##  [25] "X1805"            "X1806"            "X1807"           
##  [28] "X1808"            "X1809"            "X1810"           
##  [31] "X1811"            "X1812"            "X1813"           
##  [34] "X1814"            "X1815"            "X1816"           
##  [37] "X1817"            "X1818"            "X1819"           
##  [40] "X1820"            "X1821"            "X1822"           
##  [43] "X1823"            "X1824"            "X1825"           
##  [46] "X1826"            "X1827"            "X1828"           
##  [49] "X1829"            "X1830"            "X1831"           
##  [52] "X1832"            "X1833"            "X1834"           
##  [55] "X1835"            "X1836"            "X1837"           
##  [58] "X1838"            "X1839"            "X1840"           
##  [61] "X1841"            "X1842"            "X1843"           
##  [64] "X1844"            "X1845"            "X1846"           
##  [67] "X1847"            "X1848"            "X1849"           
##  [70] "X1850"            "X1851"            "X1852"           
##  [73] "X1853"            "X1854"            "X1855"           
##  [76] "X1856"            "X1857"            "X1858"           
##  [79] "X1859"            "X1860"            "X1861"           
##  [82] "X1862"            "X1863"            "X1864"           
##  [85] "X1865"            "X1866"            "X1867"           
##  [88] "X1868"            "X1869"            "X1870"           
##  [91] "X1871"            "X1872"            "X1873"           
##  [94] "X1874"            "X1875"            "X1876"           
##  [97] "X1877"            "X1878"            "X1879"           
## [100] "X1880"            "X1881"            "X1882"           
## [103] "X1883"            "X1884"            "X1885"           
## [106] "X1886"            "X1887"            "X1888"           
## [109] "X1889"            "X1890"            "X1891"           
## [112] "X1892"            "X1893"            "X1894"           
## [115] "X1895"            "X1896"            "X1897"           
## [118] "X1898"            "X1899"            "X1900"           
## [121] "X1901"            "X1902"            "X1903"           
## [124] "X1904"            "X1905"            "X1906"           
## [127] "X1907"            "X1908"            "X1909"           
## [130] "X1910"            "X1911"            "X1912"           
## [133] "X1913"            "X1914"            "X1915"           
## [136] "X1916"            "X1917"            "X1918"           
## [139] "X1919"            "X1920"            "X1921"           
## [142] "X1922"            "X1923"            "X1924"           
## [145] "X1925"            "X1926"            "X1927"           
## [148] "X1928"            "X1929"            "X1930"           
## [151] "X1931"            "X1932"            "X1933"           
## [154] "X1934"            "X1935"            "X1936"           
## [157] "X1937"            "X1938"            "X1939"           
## [160] "X1940"            "X1941"            "X1942"           
## [163] "X1943"            "X1944"            "X1945"           
## [166] "X1946"            "X1947"            "X1948"           
## [169] "X1949"            "X1950"            "X1951"           
## [172] "X1952"            "X1953"            "X1954"           
## [175] "X1955"            "X1956"            "X1957"           
## [178] "X1958"            "X1959"            "X1960"           
## [181] "X1961"            "X1962"            "X1963"           
## [184] "X1964"            "X1965"            "X1966"           
## [187] "X1967"            "X1968"            "X1969"           
## [190] "X1970"            "X1971"            "X1972"           
## [193] "X1973"            "X1974"            "X1975"           
## [196] "X1976"            "X1977"            "X1978"           
## [199] "X1979"            "X1980"            "X1981"           
## [202] "X1982"            "X1983"            "X1984"           
## [205] "X1985"            "X1986"            "X1987"           
## [208] "X1988"            "X1989"            "X1990"           
## [211] "X1991"            "X1992"            "X1993"           
## [214] "X1994"            "X1995"            "X1996"           
## [217] "X1997"            "X1998"            "X1999"           
## [220] "X2000"            "X2001"            "X2002"           
## [223] "X2003"            "X2004"            "X2005"           
## [226] "X2006"            "X2007"            "X2008"           
## [229] "X2009"            "X2010"            "X2011"           
## [232] "X2012"            "X2013"

There are 232 years

In the Gapminder\LandArea.csv data …

Narrow to Wide

Use subset() and join() to create a new data frame that has the country's population in 1990 as one variable and the population in 2010 as another variable.

Quantitative to Categorical

Map Exercises

In each R chunk, include the commands needed to pre-process the data, e.g., groupBy, join, and transform. Then, use mWorldMap() to generate a map command interactively. Then add the map command to your R chunk. Don't use mWorldMap() in this document.

Make a map of per-country CO_2 emissions.

Make a map of per-country CO_2 emissions per capita.

Make a map of per-country CO_2 emissions per unit of GDP.

Make a map showing which countries have more than doubled in population since 1960.

Make a bubble map showing population as the size of the bubble and fertility as the color.

Pick a Gapminder variable. Make a map that displays which countries have data over a wide range of years and which have data only recently. Hint: min(Year)