#Objective The objective of this laboratory is to plan, design, and create an information dashboard to support quantitative decision making. To accomplish this task you will have to complete a number of steps:
Delineate the necessary decision Identify what information will be relevant to decision making. Find and collect the data necessary to create your visualization plan. Organize and summarize the collected data. Design and create the best visualizations to present that information. Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding. Write a summary about what decisions you made based on the visualizations that you developed.
#Plan My goal is to look at four companies in the stock market from the food industry to invest with the potential to produce the most short-term gains. They are Beyond Meat, Inc. (BYND), Chipotle Mexican Grill, Inc. (CMG), McDonald’s Corporation (MCD), Starbucks Corporation (SBUX).
I want to create visualized dashboards to show the “daily closing price” from the past year for each stock, supported by the historical data from Yahoo Finance.
tickers <- c( "BYND", "CMG", "MCD", "SBUX")
getSymbols(tickers, from="2020-09-15",to="2021-09-14")
## 'getSymbols' currently uses auto.assign=TRUE by default, but will
## use auto.assign=FALSE in 0.5-0. You will still be able to use
## 'loadSymbols' to automatically load data. getOption("getSymbols.env")
## and getOption("getSymbols.auto.assign") will still be checked for
## alternate defaults.
##
## This message is shown once per session and may be disabled by setting
## options("getSymbols.warning4.0"=FALSE). See ?getSymbols for details.
## [1] "BYND" "CMG" "MCD" "SBUX"
ClosingPrices <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dateperiod<-c("2020-09-15",to="2021-09-14")
getSymbols("BYND", src = "yahoo", from='2020-09-15')
## [1] "BYND"
BYND_x <- BYND
dygraph(BYND_x[, -5], main = "BYND") %>%
dyCandlestick() %>%
dyAxis("y", label="Daily Stock Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 100)
getSymbols("CMG", src = "yahoo", from='2020-09-15')
## [1] "CMG"
CMG_x <- CMG
dygraph(CMG_x[, -5], main = "CMG") %>%
dyCandlestick() %>%
dyAxis("y", label="Daily Stock Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 100)
getSymbols("MCD", src = "yahoo", from='2020-09-15')
## [1] "MCD"
MCD_x <- MCD
dygraph(MCD_x[, -5], main = "MCD") %>%
dyCandlestick() %>%
dyAxis("y", label="Daily Stock Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 100)
getSymbols("SBUX", src = "yahoo", from='2020-09-15')
## [1] "SBUX"
SBUX_x <- SBUX
dygraph(SBUX_x[, -5], main = "SBUX") %>%
dyCandlestick() %>%
dyAxis("y", label="Daily Stock Closing Price") %>%
dyOptions(colors= RColorBrewer::brewer.pal(5, "Set1")) %>%
dyHighlight(highlightCircleSize = 4, highlightSeriesOpts = list(strokeWidth = 5), highlightSeriesBackgroundAlpha = 1) %>%
dyRangeSelector(height = 100)
#Summary After looking at the price trend of each stock based on the dashboards, it shows us clearly that, except for Beyond Meat, Inc. (BYND), the rest three stocks all get positive returns in the past year.
Particularly, I see Chipotle Mexican Grill, Inc. (CMG) has the best return in the past year, with a big jump in the month, so if I’d think about a short turn gain, I might be more comfortable in investing in CMG.