Dynamic Graphics with the googleVis Package ======================================================== ### Special options See the vignette of "googleVis" [4 Using googleVis with knitr](http://cran.r-project.org/web/packages/googleVis/vignettes/googleVis.pdf) define | reason ------------- | ------------- result='asis' | HTML code should not be treated as markdown. print(obj, 'chart') | to remove \ and \ tags. ### Example Form "Gallery of Examples" in [Using R Markdown with RStudio](http://www.rstudio.com/ide/docs/authoring/using_markdown) 1. gvisGeoChart 2. gvisTable 3. gvisMerge 4. gvisMap 5. gvisComboChart # in gv2.Rmd Interactive Chart and Map ---------------------------- ```{r vis, results='asis'} suppressPackageStartupMessages(library(googleVis)) T <- gvisTable(Exports, options = list(width = 200, height = 280)) G <- gvisGeoChart(Exports, locationvar = "Country", colorvar = "Profit", options = list(width = 360, height = 280, dataMode = "regions")) TG <- gvisMerge(T, G, horizontal = TRUE, tableOptions = "bgcolor=\"#CCCCCC\" cellspacing=10") print(TG, "chart") ``` Hurricane Andrew ----------------------- ```{r Map, results='asis'} ## Hurricane Andrew (1992) storm track with Google Maps AndrewMap <- gvisMap(Andrew, "LatLong", "Tip", options = list(showTip = TRUE, showLine = TRUE, enableScrollWheel = TRUE, mapType = "hybrid", useMapTypeControl = TRUE)) print(AndrewMap, "chart") ``` Dynamic Table -------------------------- ```{r table, results='asis'} ## Table with embedded links PopTable <- gvisTable(Population, options = list(width = 600, height = 300, page = "enable")) print(PopTable, "chart") ```