Task 10: Clean and Reformat (aka tidy)

Background

With stock return data from the previous task, we need to tidy this data for the creation of a time series plot. We want to look at the returns for each six-month period of the year in which the returns were reported. Your plot should highlight the tighter spread of the DJIA as compared to the other two selection methods (DARTS and PROS). We need to display a table of the DJIA returns with months on the rows and years in the columns (i.e. “spread” the data).

Reading

This reading will help you complete the tasks below.

Tasks

  • [ ] Take notes on your reading of the specified ‘R for Data Science’ chapter in the README.md or in a ‘.R’ script in the class task folder
  • [ ] Import the Dart_Expert_Dow_6month_anova data from GitHub (see details in previous task)
  • [ ] The contestant_period column is not “tidy” we want to create a month_end and year_end column from the information it contains
  • [ ] Save your “tidy” data as an .rds object
  • [ ] Create a plot that shows the six-month returns by the year in which the returns are collected
  • [ ] Create a table using code of the DJIA returns that matches the table shown below (“spread” the data)
  • [ ] Include your plots in an .Rmd file with short paragraph describing your plots. Make sure to display the tidyr code in your file
  • [ ] Push your .Rmd, .md, and .html to your GitHub repo

Final table

Month 1990 1991 1992 1993 1994 1995 1996 1997 1998
January - -0.8 6.5 -0.8 11.2 1.8 15 19.6 -0.3
February - 11 8.6 2.5 5.5 3.2 15.6 20.1 10.7
March - 15.8 7.2 9 1.6 7.3 18.4 9.6 7.6
April - 16.2 10.6 5.8 0.5 12.8 14.8 15.3 22.5
May - 17.3 17.6 6.7 1.3 19.5 9 13.3 10.6
June 2.5 17.7 3.6 7.7 -6.2 16 10.2 16.2 15
July 11.5 7.6 4.2 3.7 -5.3 19.6 1.3 20.8 7.1
August -2.3 4.4 -0.3 7.3 1.5 15.3 0.6 8.3 -13.1
September -9.2 3.4 -0.1 5.2 4.4 14 5.8 20.2 -11.8
October -8.5 4.4 -5 5.7 6.9 8.2 7.2 3 -
November -12.8 -3.3 -2.8 4.9 -0.3 13.1 15.1 3.8 -
December -9.3 6.6 0.2 8 3.6 9.3 15.5 -0.7 -