R Markdown

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(data.table)
library(ggplot2)
library(plotly)
setwd("~/Dropbox/Term_4/Visual Analytics/Assignment 2/us-stock/Step2_indicator selection")

dt<-fread("test.csv")
x<-dt[,c(3,21:32),with=FALSE]
require(tidyr)
## Loading required package: tidyr
x$id <- 1:nrow(x)
x2 <- gather(x, var, value, 2:12)
ggplotly(
  ggplot(x2, aes(var, value)) + 
  geom_line(aes(group = id,color=industry), size = 0.2, alpha = 0.3) + 
  geom_boxplot(aes(fill = var), alpha = 0.5)+
  theme(legend.position = "none",
          plot.margin=unit(c(0,0,0.9,0), "cm"),
          plot.background = element_blank(),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          panel.background = element_blank(),
          axis.title.x = element_blank(),
          axis.title.y = element_blank(),
          axis.text.x = element_blank(),
          axis.text.y = element_blank(),
          axis.ticks = element_blank()
    )
  )
## Warning: Removed 89708 rows containing non-finite values (stat_boxplot).