When using R Markdown and Knit HTML, a standalone web page is created. This means that graphics, CSS, etc. are embedded within the HTML file. When publishing or sharing your work, you only need the HTML file and there is no need to include any image files or CSS. This even applies for more dynamic content that requires HTML5 or Flash.
Using the googleVis package, dynamic tables, maps, and motion charts can be created to allow the reader to interact with the content. Note that gvis objects, by default, contain <html> and <body> tags which should be removed since Knit HTML does this already. Passing 'chart' to the print function accomplishes this.
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")