Refer to the dataset “gapminder” from package “gapminder”. The questions for this project are:

  1. Summarize and plot the median life expectancy (MLE) in 1952 for each of the 5 countries with the top MLE’s and for each of the 5 countries with the bottom MLE’s.

  2. Summarize and plot the median life expectancy (MLE) in 2007 for each of the 5 countries with the top MLE’s and for each of the 5 countries with the bottom MLE’s.

  3. Summarize and plot the median life expectancy in each year for the largest 5 countries in terms of 2007 population.

  4. Summarize and plot the median life expectancy in each year for each continent.

(a)

Column

Summary

In 1952, Europe, with 5 countries, Africa, with 4 countries, and Asia, with 1 country, were the continents with the highest Median Life Expectancy, specifically all three were over 60 years.

        country     continent      year         lifeExp           pop          
 Afghanistan:1   Africa  :4   Min.   :1952   Min.   :28.80   Min.   :  147962  
 Angola     :1   Americas:0   1st Qu.:1952   1st Qu.:30.09   1st Qu.: 2439369  
 Denmark    :1   Asia    :1   Median :1952   Median :51.03   Median : 4283048  
 Gambia     :1   Europe  :5   Mean   :1952   Mean   :51.04   Mean   : 4684766  
 Iceland    :1   Oceania :0   3rd Qu.:1952   3rd Qu.:72.06   3rd Qu.: 6955084  
 Mozambique :1                Max.   :1952   Max.   :72.67   Max.   :10381988  
 (Other)    :4                                                                 
   gdpPercap      
 Min.   :  468.5  
 1st Qu.:  804.5  
 Median : 5394.1  
 Mean   : 5065.9  
 3rd Qu.: 8838.1  
 Max.   :10095.4  
                  

Plot


(b)

Column

Summary

In 2007, Africa, with 5 countries, Europe, with 2 countries, Asia, with 2 countries, and Oceania, with 1 country, were the continents with the highest Median Life Expectancy, specifically all three were over 80 years.

             country     continent      year         lifeExp     
 Australia       :1   Africa  :5   Min.   :2007   Min.   :39.61  
 Hong Kong, China:1   Americas:0   1st Qu.:2007   1st Qu.:42.43  
 Iceland         :1   Asia    :2   Median :2007   Median :61.91  
 Japan           :1   Europe  :2   Mean   :2007   Mean   :61.87  
 Lesotho         :1   Oceania :1   3rd Qu.:2007   3rd Qu.:81.74  
 Mozambique      :1                Max.   :2007   Max.   :82.60  
 (Other)         :4                                              
      pop              gdpPercap      
 Min.   :   301931   Min.   :  823.7  
 1st Qu.:  3045627   1st Qu.: 1345.7  
 Median :  7267536   Median :18084.8  
 Mean   : 20372712   Mean   :18854.4  
 3rd Qu.: 17900251   3rd Qu.:35744.4  
 Max.   :127467972   Max.   :39725.0  
                                      

Plot


(c)

Column

Summary

Brazil, China, India, Indonesia, and United States are the countries with the largest population in 2007, which may positively correlate with their MLE for each year.

          country     continent      year         lifeExp     
 Brazil       :1   Africa  :0   Min.   :2007   Min.   :64.70  
 China        :1   Americas:2   1st Qu.:2007   1st Qu.:70.65  
 India        :1   Asia    :3   Median :2007   Median :72.39  
 Indonesia    :1   Europe  :0   Mean   :2007   Mean   :71.79  
 United States:1   Oceania :0   3rd Qu.:2007   3rd Qu.:72.96  
 Afghanistan  :0                Max.   :2007   Max.   :78.24  
 (Other)      :0                                              
      pop              gdpPercap    
 Min.   :1.900e+08   Min.   : 2452  
 1st Qu.:2.235e+08   1st Qu.: 3541  
 Median :3.011e+08   Median : 4959  
 Mean   :6.288e+08   Mean   :12594  
 3rd Qu.:1.110e+09   3rd Qu.: 9066  
 Max.   :1.319e+09   Max.   :42952  
                                    

Plot

I feel as if I was close to the correct plot, so I anticipate learning from my mistakes after reading your feedback.

(d)

Column

Summary

From what I can tell in the summary, the continents’ MLE has increased throughout the years.

# A tibble: 60 × 3
# Groups:   year [12]
    year continent  Mean
   <int> <fct>     <dbl>
 1  1952 Africa     39.1
 2  1952 Americas   53.3
 3  1952 Asia       46.3
 4  1952 Europe     64.4
 5  1952 Oceania    69.3
 6  1957 Africa     41.3
 7  1957 Americas   56.0
 8  1957 Asia       49.3
 9  1957 Europe     66.7
10  1957 Oceania    70.3
# … with 50 more rows

Plot

I am a bit stuck, so I also anticipate learning how you accomplished this plot after reading your feedback.