In this exercise you will learn to plot data using the ggplot2 package. To answer the questions below, use 4.1 Categorical vs. Categorical from Data Visualization with R.
Hint: See the code in 4.3.1 Bar chart (on summary statistics).
Hint: See the code in 4.3.1 Bar chart (on summary statistics).
Hint: See the code in 4.3.1 Bar chart (on summary statistics).
Hint: See the code in 4.3.2 Grouped kernel density plots.
Hint: Google how to interpret density plots. IBM has the greatest risk of losing big when things go wrong because it has less consistent density than the other stocks. Niether Apple or Microsoft have a density as high as IBM but their stocks dont drop as much and as rapidly as IBM does so their safer. ## Q6 Plot the distribution of yearly returns by stock using boxplots. Hint: See the code in 4.3.3 Box plots.
If I were a risk loving investor I would choose Apple. This is because it has the highest outliers, meaning that if I got very lucky its possible I could get those high returns. With IBM or Microsoft they didnt have outliers nearly this big meaning that their possible returns never got that high.
Hint: Use message, echo and results in the global chunk options. Refer to the RMarkdown Reference Guide.