Laboratory 1: Basic data analysis in R

Introduction: This laboratory is designed to familiarize you with basic data analysis in R.  You will be using the UKLungDeaths data collection which contains the number of monthly number of deaths from lung diseases in the UK for the years 1974 through 1979. This data collection has three datasets: fdeaths, mdeaths, and ldeaths which contain the monthly counts of deaths for females, males, and overall, respectively. These three datasets are time series objects, which have an interesting collection of associated helper functions. However, for this lab, you will be converting the time series to matrices by calling the data.matrix function. 

One additional useful function on time series is the time function.  For example, while fdeaths shows the measurements in terms of year and month, ftime <- time(fdeaths) produces a numeric time variable that various from 1974 through 1979 in increments of 1/12 to allow plotting on a continuous scale. 

Part 1:  Plot each of the varaibles fdeaths, mdeaths, and ldeaths on the same figure using line graphs. Label the axes and provide appropriate legends and title.

Part 2:  Compute the totals for each year of the men and women and display in a side-by-side bar chart. Each group represents a year comparing totals for men and women side by side.

Part 3:  Compute the average number of lung deaths in each month for women and for men and plot on the same graph. Be sure to label well.


Requirements:  Create a project directory lab1_xy where xy are your initials. Your code for the lab should be in an R script that you save in the project directory. Zip up the project directory and upload it to the course site on Blackboard under lab 1. Each figure should be saved as a separate pdf  (e.g., part1.pdf, part2,pdf, and part3.pdf). The saving should be part of the script.



A few relevant links and documentation suggestions: