---
title: 'ANLY 512: Data Visualization'
subtitle: "Dashboard Laboratory"
author: "Kaidi Yao"
date: "7/4/2017"
output:
flexdashboard::flex_dashboard:
source_code: embed
---
```{r message=FALSE, warning=FALSE}
library(flexdashboard)
library(ggplot2)
library(ggthemes)
library(xts)
library(quantmod)
library(plyr)
library(dygraphs)
library(PerformanceAnalytics)
```
```{r message=FALSE, warning=FALSE}
twtr <- read.csv(file = "C:/Users/ykd21/Downloads/TWTR.csv")
msft <- read.csv(file = "C:/Users/ykd21/Downloads/MSFT.csv")
aapl <- read.csv(file = "C:/Users/ykd21/Downloads/AAPL.csv")
```
Column {data-width=400}
------------------------------------------------------
### Chart of stock prices from 11-7-2013 to 7-3-2017.
```{r message=FALSE, warning=FALSE}
ggplot(twtr,aes(Date,Close)) +
geom_point(aes(color="twtr")) +
geom_point(data=msft,aes(color="msft")) + geom_point(data=aapl,aes(color="aapl"))+
labs(title = "Closing Stock Prices: Twitter, Microsoft & Apple", x = "Date", y = "Close Price") + theme_classic()
```
Column {data-width=300}
------------------------------------------------------
### Correlation of TWTR, MSFT & AAPL
```{r message=FALSE, warning=FALSE}
c<- getSymbols(c("TWTR","MSFT","AAPL"))
Stockdata <- cbind(diff(log(Cl(AAPL))),diff(log(Cl(TWTR))),diff(log(Cl(MSFT))))
chart.Correlation(Stockdata)
```
Column {data-width=300}
------------------------------------------------------
### Price and Volume of TWTR
```{r message=FALSE, warning=FALSE}
chartSeries(TWTR, subset='last 6 months')
```
### Price and Volume of MSFT
```{r message=FALSE, warning=FALSE}
chartSeries(MSFT, subset='last 6 months')
```
### Price and Volume of AAPL
```{r message=FALSE, warning=FALSE}
chartSeries(AAPL, subset='last 6 months')
```