R> M <- gvisMotionChart(Fruits, "Fruit", "Year")
R> G <- createGoogleGadget(M)
R> cat(G, file="myGadget.xml")
In orderto use the gadget, the ﬁle myGadget.xml has to be hosted online, e.g. using
GoogleDocs. Suppose the URL to the gadgetis http://example.com/myGadget.xml,
than you can embed the gadget
• in a Google Site via the menu:
”Insert”-> ”More gadgets ...”-> ”Add gadget URL”,
• in a Google Code wiki via the wiki:gadget tag, e.g.:
<wiki:gadget url="http://example.com/gadget.xml" />,
• in Blogger via the design tab, see site gadgets.
However, the situation is diﬀerent again, if you would like to include the googleVis
output into a blogger post. In this case a gadget does not work. You can either
copy and paste the chart directly into your post, but then it does not seem to work
with MS Internet Explorer, or you use an indirect approach. This means that the
googleVis chart has to be hosted on a separate page (e.g. in a public Dropbox
folder) and is embedded into the blog post by using the <iframe> tag, e.g.:
<iframe width="100%" height="400px" frameborder="0"
Foran example see the following blog entry: http://lamages.blogspot.com/2011/09/including-
3.4 Embedding googleVis in web sites dynamically
In this section we provide examples how the googleVis functions can be embedded
into web sites dynamically.
The R packages R.rsp [Ben12] and brew [Hor11a] are two options to integrate
Rsnippets into html code. While the R.rsp package comes with its own internal
web server, brew requires the Apache HTTP server [Fou10a] with the RApache
[Hor11b] module installed. Please note that currently the RApache module only
runs on UNIX/Linux and Mac OS X.
Since version 2.11.0 R ships with its own internal web server and with Rook [Hor13]
and shiny [RI13] there are also two alternatives that use this facility. Both pack-
ages allow users to deploy web application locally with very little overhead. The
shiny framework is the newest and certainly easiest option to get started with web
apps using R and googleVis .