History: Profile_r_test6_googleVis
Source of version: 2
Copy to clipboard
Testing some nice graphs from Google Visualization API through R googleVis package and PluginR in Tiki. {maketoc title="" levels="2,3"} !! googleVIs R-package graphs through PluginR in Tiki !!! Section 1 This code: {CODE(colors="r",wrap="1")} {RR(loadandsave="1", wikisyntax="0")} # Example adapted from the ones shown here: http://code.google.com/p/google-motion-charts-with-r/ # and here: http://www.r-bloggers.com/interactive-reports-in-r-with-knitr-and-rstudio/ # # If required the first time, uncomment the following line/s to install the required R packages, and edit the path and url to suite your needs. if(!require(googleVis)){ install.packages("googleVis", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } {RR} {CODE} Produces (nothing if the package is already installed): {RR(loadandsave="1", wikisyntax="0")} # Example adapted from the ones shown here: http://code.google.com/p/google-motion-charts-with-r/ # and here: http://www.r-bloggers.com/interactive-reports-in-r-with-knitr-and-rstudio/ # # If required the first time, uncomment the following line/s to install the required R packages, and edit the path and url to suite your needs. if(!require(googleVis)){ install.packages("googleVis", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } {RR} !!! Section 2 {R(wikisyntax="0" loadandsave="1" type="text/csv" onefile="0" echo="1")}require(googleVis) df <- data.frame(x = 1:10, y = 1:10) ## load the googleVis package suppressPackageStartupMessages(library(googleVis)) ## create the scatter chart sc <- gvisScatterChart(data=df, options=list(width=300, height=300, legend='none', hAxis="{title:'x'}", vAxis="{title:'y'}") ) print(sc, "chart") ## same as cat(sc$html$chart) {R} !!! Section 3 {R(loadandsave="1", wikisyntax="0", echo="1")} require(googleVis) geo <- gvisGeoChart(CityPopularity, locationvar = "City", colorvar = "Popularity", options = list(region="US", height=350, displayMode = "markers", colorAxis = "{colors: ['orange','blue']}") ) print(geo, "chart") {R} !!! Section 4 {R(loadandsave="1", wikisyntax="0", echo="1")} require(googleVis) M <- gvisMotionChart(Fruits, "Fruit", "Year", options = list(width = 550, height = 450)) print(M, "chart") {R} Once everything is ready in your system (all packages installed, etc), you'll see something like this: {img src="http://ueb.vhir.org/display577" styleimage="border" }