See the vignette of “googleVis” 4 Using googleVis with knitr
| define | reason |
|---|---|
| result='asis' | HTML code should not be treated as markdown. |
| print(obj, 'chart') | to remove <html> and <body> tags. |
### Example Form “Gallery of Examples” in Using R Markdown with RStudio
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 (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")
## Table with embedded links
PopTable <- gvisTable(Population, options = list(width = 600, height = 300,
page = "enable"))
print(PopTable, "chart")