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(googleVis)
## Creating a generic function for 'toJSON' from package 'jsonlite' in package 'googleVis'
##
## Welcome to googleVis version 0.6.0
##
## Please read the Google API Terms of Use
## before you start using the package:
## https://developers.google.com/terms/
##
## Note, the plot method of googleVis will by default use
## the standard browser to display its output.
##
## See the googleVis package vignettes for more details,
## or visit http://github.com/mages/googleVis.
##
## To suppress this message use:
## suppressPackageStartupMessages(library(googleVis))
DengueIndia <- read.table("dengue.txt", header = TRUE,
sep="\t",
fill = TRUE,
strip.white = TRUE,
stringsAsFactors = TRUE,
na.strings = "EMPTY")
head(DengueIndia)
## States Denguecase
## 1 Andhra Pradesh 181
## 2 Arunachal Pradesh 0
## 3 Assam 18
## 4 Bihar 1
## 5 Chattisgarh 51
## 6 Goa 29
DenguecaseIndia <- DengueIndia[, c("States","Denguecase")]
DengueStateName <- DengueIndia[, "States"]
head(DengueStateName)
## [1] Andhra Pradesh Arunachal Pradesh Assam Bihar
## [5] Chattisgarh Goa
## 35 Levels: Andhra Pradesh A& N Island Arunachal Pradesh Assam ... West Bengal
head(DenguecaseIndia)
## States Denguecase
## 1 Andhra Pradesh 181
## 2 Arunachal Pradesh 0
## 3 Assam 18
## 4 Bihar 1
## 5 Chattisgarh 51
## 6 Goa 29
DengueStates <- gvisGeoChart(DengueIndia, "States", "Denguecase", options=list(region="IN", displayMode="regions", resolution="provinces"))
You can also embed plots, for example:
print(DengueStates, 'chart') ## same as cat(sc$html$chart)
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.