dividends
Import dividends of Ford Motor Company and General Motors Company since 2015.economic data
Import the U.S. Industrial Production Index since 1920.exchange rates
Import exchange rate between the U.S. dollar and the South Korean Won.stock prices
Import stock price of Apple, Microsoft and Facebook since 2010.filter
Select Apple and Microsoft.Scatterplot
Plot relationships between volume and closing price for Apple, Microsoft and Facebook, using the facet_wrap function. Add the best fit line.dividends
Import dividends of Ford Motor Company and General Motors Company since 2015.## # A tibble: 40 x 3
## symbol date dividends
## <chr> <date> <dbl>
## 1 F 2015-01-28 0.15
## 2 F 2015-04-29 0.15
## 3 F 2015-07-29 0.15
## 4 F 2015-10-28 0.15
## 5 F 2016-01-27 0.4
## 6 F 2016-04-27 0.15
## 7 F 2016-07-26 0.15
## 8 F 2016-10-25 0.15
## 9 F 2017-01-18 0.2
## 10 F 2017-04-18 0.15
## # … with 30 more rows
economic data
Import the U.S. Industrial Production Index since 1920.Hint: Find the symbol in FRED.
## # A tibble: 1,196 x 2
## date price
## <date> <dbl>
## 1 1920-01-01 5.79
## 2 1920-02-01 5.79
## 3 1920-03-01 5.68
## 4 1920-04-01 5.37
## 5 1920-05-01 5.51
## 6 1920-06-01 5.57
## 7 1920-07-01 5.43
## 8 1920-08-01 5.46
## 9 1920-09-01 5.26
## 10 1920-10-01 5.04
## # … with 1,186 more rows
exchange rates
Import exchange rate between the U.S. dollar and the South Korean Won.Hint: Find the symbol in oanda.com.
## Warning: Oanda only provides historical data for the past 180 days. Symbol:
## US/KRW
## Warning: x = 'US/KRW', get = 'exchange.rates': Error in getSymbols.oanda(Symbols = Currencies, from = from, to = to, : object 'fr' not found
## [1] NA
stock prices
Import stock price of Apple, Microsoft and Facebook since 2010.## # A tibble: 6,778 x 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 AAPL 2010-01-04 30.5 30.6 30.3 30.6 123432400 26.7
## 2 AAPL 2010-01-05 30.7 30.8 30.5 30.6 150476200 26.7
## 3 AAPL 2010-01-06 30.6 30.7 30.1 30.1 138040000 26.3
## 4 AAPL 2010-01-07 30.2 30.3 29.9 30.1 119282800 26.3
## 5 AAPL 2010-01-08 30.0 30.3 29.9 30.3 111902700 26.4
## 6 AAPL 2010-01-11 30.4 30.4 29.8 30.0 115557400 26.2
## 7 AAPL 2010-01-12 29.9 30.0 29.5 29.7 148614900 25.9
## 8 AAPL 2010-01-13 29.7 30.1 29.2 30.1 151473000 26.3
## 9 AAPL 2010-01-14 30.0 30.1 29.9 29.9 108223500 26.1
## 10 AAPL 2010-01-15 30.1 30.2 29.4 29.4 148516900 25.7
## # … with 6,768 more rows
filter
Select Apple and Microsoft.## # A tibble: 4,918 x 8
## symbol date open high low close volume adjusted
## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 AAPL 2010-01-04 30.5 30.6 30.3 30.6 123432400 26.7
## 2 AAPL 2010-01-05 30.7 30.8 30.5 30.6 150476200 26.7
## 3 AAPL 2010-01-06 30.6 30.7 30.1 30.1 138040000 26.3
## 4 AAPL 2010-01-07 30.2 30.3 29.9 30.1 119282800 26.3
## 5 AAPL 2010-01-08 30.0 30.3 29.9 30.3 111902700 26.4
## 6 AAPL 2010-01-11 30.4 30.4 29.8 30.0 115557400 26.2
## 7 AAPL 2010-01-12 29.9 30.0 29.5 29.7 148614900 25.9
## 8 AAPL 2010-01-13 29.7 30.1 29.2 30.1 151473000 26.3
## 9 AAPL 2010-01-14 30.0 30.1 29.9 29.9 108223500 26.1
## 10 AAPL 2010-01-15 30.1 30.2 29.4 29.4 148516900 25.7
## # … with 4,908 more rows
Scatterplot
Plot relationships between volume and closing price for Apple, Microsoft and Facebook, using the facet_wrap function. Add the best fit line.Hint: See the code in 4.2.1 Scatterplot
Hint: See the scatterplot you created in the previous question.
The relationship is when the lower the volume the higher the stock. This means AAPL is the most sensative to the relationship becasue its the most downward sloping.
Hint: Use message
, echo
and results
in the chunk options. Refer to the RMarkdown Reference Guide.