April 19, 2017

Summary

This Project is to create interactive plot to analyze Google's branch stock index from 2015 to the most recent date of 2017 (2017-04-17). The historical Google stock index data can be found from here in Google Finance.

Data Manipulation

R code

library(plyr)
library(plotly)
setwd("F:/google")

google_manipulation <- function(file, col_name) {
  data <- read.csv(file, stringsAsFactors = FALSE)[, c(1,5)]
  names(data) <- c("date", col_name)
  data$date <- as.Date(data$date, format = "%d-%b-%y")
  return(data)
}

Data Manipulation

R code (continued)

credit_card <- google_manipulation("crcard.csv", "credit_card")
education <- google_manipulation("educat.csv", "education")
financial_planning <- google_manipulation("finpln.csv", "financial_planning")
insurance <- google_manipulation("insur.csv", "insurance")
small_business <- google_manipulation("smallbiz.csv", "small_business")

google <- join_all(list(credit_card, education, financial_planning, 
                        insurance, small_business), 
                   by = "date")

google_15to17 <- subset(google, subset = google$date >= "2015-01-01")

Interactive Plot by Using Plotly

A Time Series Plot of Google Stock Index are made with two features:

  1. Basic Range Slider to select the range of date by moving the slider;

  2. Selector Buttons to selct the data within 3 months, 6 months, 1 year or year to date (YTD).