This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(flexdashboard)
library(quantmod)
library(dygraphs)
library(lubridate)
library(RColorBrewer)
tickers<-c("AAPL","MSFT","TWTR")
getSymbols(tickers)
## [1] "AAPL" "MSFT" "TWTR"
closePrice<-do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dateWindow<-c("2014-05-01", "2017-05-01")
dygraph(closePrice, main="Value", group="Stock") %>%
dyRebase(value=100) %>%
dyAxis("y", label="Close Price(USD)") %>%
dyOptions(axisLineWidth = 1.5, colors = RColorBrewer::brewer.pal(3, "Set1")) %>%
dyRangeSelector(dateWindow = dateWindow)
tickers<-c("AAPL","MSFT","TWTR")
getSymbols(tickers)
## [1] "AAPL" "MSFT" "TWTR"
closePrice<-do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dateWindow<-c("2014-05-01", "2017-05-01")
dygraph(closePrice, main="Value", group="Stock") %>%
dyRebase(percent = TRUE) %>%
dyAxis("y", label="Close Price(USD)") %>%
dyOptions(axisLineWidth = 1.5, colors = RColorBrewer::brewer.pal(3, "Set1")) %>%
dyRangeSelector(dateWindow = dateWindow)
tickers<-c("AAPL","MSFT","TWTR")
getSymbols(tickers)
## [1] "AAPL" "MSFT" "TWTR"
closePrice<-do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dateWindow<-c("2014-05-01", "2017-05-01")
dygraph(closePrice, main="None", group="Stock") %>%
dyAxis("y", label="Close Price(USD)") %>%
dyOptions(axisLineWidth = 1.5, colors = RColorBrewer::brewer.pal(3, "Set1")) %>%
dyRangeSelector(dateWindow = dateWindow)
Column {.tabset data-width=500} ———————————————————————– ### Apple
startdate<-ymd("2017-01-01")
invisible(getSymbols("AAPL", src = "yahoo", from=startdate))
Apple<-AAPL[,-5]
colnames(Apple)<-c("Open","High","Low","Close","Adjusted")
dygraph(Apple, main = "Apple(AAPL)") %>%
dyAxis("y", label="Price(USD)") %>%
dyOptions(axisLineWidth = 1.5, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()
startdate<-ymd("2017-01-01")
invisible(getSymbols("MSFT", src = "yahoo", from=startdate))
Microsoft<-MSFT[,-5]
colnames(Microsoft)<-c("Open","High","Low","Close","Adjusted")
dygraph(Microsoft, main = "Microsoft(MSFT)") %>%
dyAxis("y", label="Price(USD)") %>%
dyOptions(axisLineWidth = 1.5, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()
startdate<-ymd("2017-01-01")
invisible(getSymbols("TWTR", src = "yahoo", from=startdate))
Twitter<-TWTR[,-5]
colnames(Twitter)<-c("Open","High","Low","Close","Adjusted")
dygraph(Twitter, main = "Twitter(TWTR)") %>%
dyAxis("y", label="Price(USD)") %>%
dyOptions(axisLineWidth = 1.5, colors = RColorBrewer::brewer.pal(5, "Set1")) %>%
dyCandlestick()