You are evaluating the performance of two stocks, Microsoft and Apple, for future investment.
Hint: Add group_by(symbol) at the end of the code so that calculations below will be done per stock.
-In the first row the stock is for Microsoft on March 8th, 1999.The open price was 38.87500 which was the price when the stock first opened. The high was 39.80857 which was the highest price for the stock during this day. Next is the low which was 38.75000 which was the lowest price of the stock for the day. The closing was 39.75000 which was the closing price for the end of the day. Next is the volume which was 46726000 which was how many people traded that particular microsoft stock for the day. Finally the adjusted column for this day shows 28.72423 which was the closing price adjusted to dividends and stock prices.
Hint: Use ggplot2::facet_wrap. Refer to the ggplot2 cheatsheet. See the section for Faceting.
Hint: Take the adjusted variable from Stocks, and calculate yearly returns using tq_transmute(), instead of tq_mutate(), which is used when periodicity changes. Another difference between the two is that tq_transmute() returns only newly-created columns while tq_mutate() adds new columns to existing variables.
Hint: Refer to the ggplot2 cheatsheet. Look for geom_boxplot under Two Variables. Note that the discrete variable should be mapped to the x-axis and the continuous variable to the y-axis.
Hint: Discuss your answer in terms of the median in the boxplot you created in Q5. Google “Interpreting boxplots in R” to find the information you need.
Hint: Discuss your answer in terms of the interquartile range (the middle 50%) of the boxplot you created in Q5.
Hint: Change echo and results in the chunk options. The published webpage should display charts.