Life Expectancy 1950 - 1990
- Download the RMarkdown file called life-expectancy.Rmd. You can use that
file as a template for your work. Make sure to replace “Your Name” in
the YAML with your name.
- Knit the RMarkdown file and read through the corresponding html
file. If you encounter errors you are most likely missing some packages
that are being used. Either work in the lab or install the packages on
your machines. Use the command
install.packages("packagename")
. Make sure to replace
packagename
by the name of the package you want to install.
Beware upper and lower cases!
- Work through the code in the R markdown file line by line and run it
in an R session.
- The file
gap7080.csv
consists of additional values of
average life expectancy for the U.S., Canada and Mexico in the 70s and
80s. Expand the file life-expectancy.Rmd
to include values
for the 70s and 80s, i.e. you are asked to
- Visualize the life expectancy for the United States, Canada and
Mexico in a line chart (with three lines in different colours).
- Comment in your writeup about what you see in the plot. Make sure
that the incorrect value for Canada in 1957 is fixed.
Note:
- this homework is supposed to be mainly a code reading exercise. You
should not have to program extensively. Instead, you have to figure out
which pieces you need to copy and adjust.
- the R command for combining two datasets that have the same
structure is
rbind
, used as:
combined <- rbind(data1, data2)
For the submission: submit your solution in an R Markdown file and
(just for insurance) submit the corresponding html file with it.