In this exercise you will learn to plot data using the ggplot2 package. To this end, you will make your own note of 4.2 Quantitative vs. Quantitative from Data Visualization with R.

## # A tibble: 390 x 8
##    symbol date        open  high   low close   volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 AAPL   2019-01-02  155.  159.  154.  158. 37039700     156.
##  2 AAPL   2019-01-03  144.  146.  142   142. 91312200     141.
##  3 AAPL   2019-01-04  145.  149.  144.  148. 58607100     147.
##  4 AAPL   2019-01-07  149.  149.  146.  148. 54777800     146.
##  5 AAPL   2019-01-08  150.  152.  149.  151. 41025300     149.
##  6 AAPL   2019-01-09  151.  155.  150.  153. 45099100     151.
##  7 AAPL   2019-01-10  152.  154.  151.  154. 35780700     152.
##  8 AAPL   2019-01-11  153.  154.  152.  152. 27023200     150.
##  9 AAPL   2019-01-14  151.  151.  149.  150  32439200     148.
## 10 AAPL   2019-01-15  150.  153.  150.  153. 28710900     151.
## # … with 380 more rows

Q1 filter Select Apple and save it under plotdata.

Hint: See the code in 4.1.2 Line plot.

## # A tibble: 195 x 8
##    symbol date        open  high   low close   volume adjusted
##    <chr>  <date>     <dbl> <dbl> <dbl> <dbl>    <dbl>    <dbl>
##  1 AAPL   2019-01-02  155.  159.  154.  158. 37039700     156.
##  2 AAPL   2019-01-03  144.  146.  142   142. 91312200     141.
##  3 AAPL   2019-01-04  145.  149.  144.  148. 58607100     147.
##  4 AAPL   2019-01-07  149.  149.  146.  148. 54777800     146.
##  5 AAPL   2019-01-08  150.  152.  149.  151. 41025300     149.
##  6 AAPL   2019-01-09  151.  155.  150.  153. 45099100     151.
##  7 AAPL   2019-01-10  152.  154.  151.  154. 35780700     152.
##  8 AAPL   2019-01-11  153.  154.  152.  152. 27023200     150.
##  9 AAPL   2019-01-14  151.  151.  149.  150  32439200     148.
## 10 AAPL   2019-01-15  150.  153.  150.  153. 28710900     151.
## # … with 185 more rows

Q2 Line plot Plot the relationship between time (date) and Apple stock prices (close).

Hint: See the code in 4.1.2 Line plot.

Q3 In what month did the Apple stock peak this year?.

Hint: See the line plot you created in the previous question.

October

Q4 Scatterplot Plot the relationship between closing price and volume for Apple.

Hint: See the code in 4.2.1 Scatterplot

Q5 Scatterplot Add the best fit line.

Hint: See the code in 4.2.1 Scatterplot

Q6 Describe the relationship between closing price and volume for Apple.

As the volume decreases, so does the closing price.

Q7 Scatterplot Plot the relationship between closing price and volume for both Apple and Microsoft.

Hint: Use facet_wrap().

Q8 Hide the messages, the code and its results on the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.