dividends Import dividends of Walmart and Target since 2010.economic.data Import real U.S. GDP growth since 2000.exchange rates Import exchange rate between the U.S. dollar and the Japanese yen.stock prices Import stock price of Google, Apple and Facebook since 2010.filter Select Apple and Facebook.Scatterplot Plot relationships between volume and closing price for Google, Apple and Facebook, using the facet_wrap function. Add the best fit line.dividends Import dividends of Walmart and Target since 2010.## # A tibble: 80 x 3
## symbol date dividends
## <chr> <date> <dbl>
## 1 WMT 2010-03-10 0.303
## 2 WMT 2010-05-12 0.303
## 3 WMT 2010-08-11 0.303
## 4 WMT 2010-12-08 0.303
## 5 WMT 2011-03-09 0.365
## 6 WMT 2011-05-11 0.365
## 7 WMT 2011-08-10 0.365
## 8 WMT 2011-12-07 0.365
## 9 WMT 2012-03-08 0.398
## 10 WMT 2012-05-09 0.398
## # … with 70 more rows
economic.data Import real U.S. GDP growth since 2000.Hint: Find the symbol in FRED. Select in the list of related variables, Percent Change from Preceding Period, Annual, Not Seasonally Adjusted.
## Warning: x = 'GDP1', get = 'economic.data': Error in getSymbols.FRED(Symbols = "GDP1", env = <environment>, verbose = FALSE, : Unable to import "GDP1".
## Failed to download file. Error message:
## cannot open URL 'https://fred.stlouisfed.org/series/GDP1/downloaddata/GDP1.csv'
## If this is related to https, possible solutions are:
## 1. Explicitly pass method= via the getSymbols call (or via setDefaults)
## 2. Install downloader, which may be able to automagically determine a method
## 3. Set the download.file.method global option
## [1] NA
exchange rates Import exchange rate between the U.S. dollar and the Japanese yen.Hint: Find the symbol in oanda.com.
## Warning: Oanda only provides historical data for the past 180 days. Symbol:
## USD/JPY
## # A tibble: 180 x 2
## date exchange.rate
## <date> <dbl>
## 1 2019-06-16 109.
## 2 2019-06-17 109.
## 3 2019-06-18 108.
## 4 2019-06-19 108.
## 5 2019-06-20 108.
## 6 2019-06-21 107.
## 7 2019-06-22 107.
## 8 2019-06-23 107.
## 9 2019-06-24 107.
## 10 2019-06-25 107.
## # … with 170 more rows
stock prices Import stock price of Google, Apple and Facebook since 2010.## # A tibble: 6,913 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.6
## 2 AAPL 2010-01-05 30.7 30.8 30.5 30.6 150476200 26.6
## 3 AAPL 2010-01-06 30.6 30.7 30.1 30.1 138040000 26.2
## 4 AAPL 2010-01-07 30.2 30.3 29.9 30.1 119282800 26.2
## 5 AAPL 2010-01-08 30.0 30.3 29.9 30.3 111902700 26.3
## 6 AAPL 2010-01-11 30.4 30.4 29.8 30.0 115557400 26.1
## 7 AAPL 2010-01-12 29.9 30.0 29.5 29.7 148614900 25.8
## 8 AAPL 2010-01-13 29.7 30.1 29.2 30.1 151473000 26.2
## 9 AAPL 2010-01-14 30.0 30.1 29.9 29.9 108223500 26.0
## 10 AAPL 2010-01-15 30.1 30.2 29.4 29.4 148516900 25.6
## # … with 6,903 more rows
filter Select Apple and Facebook.Hint: See the code in 1.2.2 Selecting observations
## # A tibble: 4,409 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.6
## 2 AAPL 2010-01-05 30.7 30.8 30.5 30.6 150476200 26.6
## 3 AAPL 2010-01-06 30.6 30.7 30.1 30.1 138040000 26.2
## 4 AAPL 2010-01-07 30.2 30.3 29.9 30.1 119282800 26.2
## 5 AAPL 2010-01-08 30.0 30.3 29.9 30.3 111902700 26.3
## 6 AAPL 2010-01-11 30.4 30.4 29.8 30.0 115557400 26.1
## 7 AAPL 2010-01-12 29.9 30.0 29.5 29.7 148614900 25.8
## 8 AAPL 2010-01-13 29.7 30.1 29.2 30.1 151473000 26.2
## 9 AAPL 2010-01-14 30.0 30.1 29.9 29.9 108223500 26.0
## 10 AAPL 2010-01-15 30.1 30.2 29.4 29.4 148516900 25.6
## # … with 4,399 more rows
Scatterplot Plot relationships between volume and closing price for Google, Apple and Facebook, using the facet_wrap function. Add the best fit line.Hint: See the code in 4.2.1 Scatterplot
## # A tibble: 6,913 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.6
## 2 AAPL 2010-01-05 30.7 30.8 30.5 30.6 150476200 26.6
## 3 AAPL 2010-01-06 30.6 30.7 30.1 30.1 138040000 26.2
## 4 AAPL 2010-01-07 30.2 30.3 29.9 30.1 119282800 26.2
## 5 AAPL 2010-01-08 30.0 30.3 29.9 30.3 111902700 26.3
## 6 AAPL 2010-01-11 30.4 30.4 29.8 30.0 115557400 26.1
## 7 AAPL 2010-01-12 29.9 30.0 29.5 29.7 148614900 25.8
## 8 AAPL 2010-01-13 29.7 30.1 29.2 30.1 151473000 26.2
## 9 AAPL 2010-01-14 30.0 30.1 29.9 29.9 108223500 26.0
## 10 AAPL 2010-01-15 30.1 30.2 29.4 29.4 148516900 25.6
## # … with 6,903 more rows
Hint: See the scatterplot you created in the previous question.
When greater volume of stock gets sold the price increases. Both the trading volume and closing prices are negativley assoiated, the more shares sold the lower the closing price ## Q8 Hide the messages and the code, but display results of the code from the webpage. Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.