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:

#Sys.setenv("plotly_username"="chowdhuryanimesh1")
#Sys.setenv("plotly_api_key"="x25QXcZ2ccIqSg67wQZl")
#install.packages("devtools")
#debug(utils:::unpackPkgZip)
#install.packages("plotly")
#install.packages("data.table")
#library(plotly)
#packageVersion('plotly')
data("diamonds")
## Warning in data("diamonds"): data set 'diamonds' not found
library(plotly)
## Warning: package 'plotly' was built under R version 3.3.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.3.3
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
p<-ggplot(aes(y=price,x=carat),data=diamonds)+geom_point(aes(color=color,alpha=1/2000))
ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
library(plotly)

p <- ggplot(diamonds, aes(x = price)) + 
  geom_density(aes(fill = "epanechnikov"), kernel = "epanechnikov") + 
  facet_grid(~cut) + 
  ggtitle("Kernel density estimate with Facets")

ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
library(plotly)
p <- ggplot(aes(x = price),data=diamonds) + 
  geom_density(aes(fill = color), alpha = 0.5) + 
  ggtitle("Kernel Density estimates by group")

ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
library(plotly)
p<- ggplot(diamonds, aes(price,fill = cut))+geom_histogram(binwidth = 500,colour='black')
ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
p<- ggplot(aes(x=clarity,y=price),data=diamonds)+stat_summary(fun.y="sum", geom="bar",colour="black",fill='white')
ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
data("USArrests")
data("quakes")
#install.packages(c("maps", "mapdata"))
library(maps)
## Warning: package 'maps' was built under R version 3.3.3
library(mapdata)
## Warning: package 'mapdata' was built under R version 3.3.3
map('usa')

require(graphics)
pairs(USArrests, panel = panel.smooth, main = "USArrests data")

# antivirus disallowing to update the ggplot2 package use this command 
#debug(utils:::unpackPkgZip)
#install.packages("ggplot2")

`

USArrests$name = row.names(USArrests)
Region_Info<-read.csv("state_table.csv")
#Left Join - Merging USArrests and Region_Info

Arrests_US<-merge(x = USArrests, y = Region_Info, by = "name", all.x = TRUE)
#install.packages("stringr")
library(plotly)
p<-ggplot(aes(x=Murder,y=Assault),data=Arrests_US)+geom_point(aes(color=name,size=UrbanPop))+facet_wrap(~census_region_name,ncol=2)
ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
#install.packages("rgl")
library(rgl)
## Warning: package 'rgl' was built under R version 3.3.3
plot3d(USArrests$Murder, USArrests$Assault, USArrests$Rape, type="s", size=1, lit=TRUE, main = "Murder Vs Assault Vs Rape",sub="3-D Plot",col = c("red","blue","green"),xlab = "USArrests-Murder", ylab="USArrests-Assault",zlab = "USArrests-Rape")
Browser_Market<-read.csv("Browser_Market_Share.csv")
library(zoo)
## Warning: package 'zoo' was built under R version 3.3.3
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
Browser_Market$Date<-as.Date(as.yearmon(Browser_Market$Date))
ggplot(aes(Date,Chrome),data=Browser_Market)+geom_line()

#install.packages("reshape")
library(reshape)
## Warning: package 'reshape' was built under R version 3.3.3
## 
## Attaching package: 'reshape'
## The following object is masked from 'package:plotly':
## 
##     rename
Browser_Market_Upd <- melt(Browser_Market, id=(c("Date")))
library(plotly)
p<-ggplot(aes(Date,value),data=subset(Browser_Market_Upd, variable %in% c("Chrome","Firefox","IE","Mozilla","Other")))+geom_line(aes(color=variable))

ggplotly(p)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`