Assignment 3
Instructions
Please submit your assignment as html file to me via email. Please call your assignment: “yourname_assignment3.html”. For example, I would submit something called “popescu_assignment3.html”. Please make sure that it is all in lower case.
To match the appearance of this template, ensure that your assignment preamble or YAML is set up as follows
---
title: "Assignment 3"
author: "Your Name"
date: "October 03, 2024"
format:
html:
toc: true
number-sections: true
colorlinks: true
smooth-scroll: true
embed-resources: true
---
Important: Headers like “Question” should be marked with a #
(for example, # Question
). This will format the text as a bold, larger header when the document is rendered, and it will also appear in the Table of Contents. For regular text, simply write it on the line below the header.
Please answer all the questions below.
Question 1
Open the urbanization and life expectancy datasets.
Question 2
Clean the datasets by removing the countries with no labels or that are called “OWID_KOS”, “OWID_WRL”, calculate the averages for the entire period, and perform a left merge.
Question 3
Get hold of and open in your computer’s memory a shape file of the world.
Question 4
Merge the dataframe to the spatial dataframe. What are the countries that are in your spatial dataframe and that are not in your dataframe.
Question 5
Create a map that shows life expectancy in Africa. Use the follwing countries to set the extent of your map: North-Tunisia, South-South Africa, West-Mauritania, East-Somalia. Note: do not simply subset the data based on continent value. Also add some error to your coordinates so that your map does not look too squished (recommended error of 7).
Question 6
Compare African countries to the rest of the world. Is life expectancy higher, lower, or the same as the rest of the world? Perform relevant tests.
Question 7
Compare African countries to the rest of the world. Is urbanization higher, lower, or the same, as the rest of the world? Perform relevant tests.
Question 8
Create a box plot for life expectancy comparing Africa to the rest of the world.
Question 9
Create a box plot for urbanization comparing Africa to the rest of the world.
Question 10
Create two maps side by side with life expectancy in Africa in 1980 and 2010. Note, make sure that you have one legend for both maps and that the the min and max values are the same.
Question 11
Map changes in life expectancy between 1980 and 2010 in Africa.
Question 12
What are the countries in Africa where people live shorter lives in 2010 than in 1980? How many years did they live in 1980 and how many years did they live in 2010.