Task 13: Controlling categorical variables (factors)

Background

When we are visualizing data with categorical variables, we have to deal with character strings as groupings. The problem with summarizing categorical data in a table or a plot is how to order the groups. Using the concept of Factors allows us to dictate the order of these groupings for presentation. We will revisit the stock data from a previous task to create a table and a plot that has the months correctly labeled and ordered.

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
  • [ ] Load your “tidy” data from task 10 using the stock return data
  • [ ] Create a plot that shows the six-month returns by the month in which the returns are collected using the eight years of 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