Google Chart Tools googlevis



Similar documents
Google Visualisation API googlev is

Google Visualisation API R googlevis Markus Gesmann, Diego de Castillo googlev is R Google Visualisation API Google Visual

07_経営論集2010 小松先生.indd

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

m_sotsuron

0序文‐1章.indd

WebGIS WebGIS(Web Geographic Information System) Web WebGIS Web WebGIS API(Application Program Interface) Web Google GoogleMaps API WebGISJSGI i

JavaScriptプログラミング入門

Introduction Purpose This training course describes the configuration and session features of the High-performance Embedded Workshop (HEW), a key tool

コンピュータサイエンス 4. ウェブプログラミング

カンペキな初心者のための、Adobe® AIR™の基礎の基礎

ohp.mgp

Microsoft Word - Win-Outlook.docx

JavaScript の使い方

1 I EViews View Proc Freeze

fx-9860G Manager PLUS_J

経営論集2011_07_小松先生.indd

(1) <html>,,,,, <> ( ) (/ ) (2) <!DOCTYPE html> HTML5 (3) <html> HTML (4) <html lang= ja > html (ja) (5) JavaScript CSS (6) <meta charset= shift jis >

Web apache


Microsoft Word - D JP.docx

ProVAL Recent Projects, ProVAL Online 3 Recent Projects ProVAL Online Show Online Content on the Start Page Page 13

jquery

あいち電子自治体ガイドライン(第1章)

Web±ÜÍ÷¤Î³Ú¤·¤µ¤ò¹â¤á¤ëWeb¥Ú¡¼¥¸²ÄÄ°²½¥·¥¹¥Æ¥à

はじめに

pp R R Word R R R R Excel SPSS R Microsoft Word 2016 OS Windows7 Word2010 Microsoft Office2010 R Emacs ESS R R R R https:

What 色 々な Web サービスを 提 供 している 会 社 です 会 社 ) 私 ) ぜひ 名 前 を 覚 えていってくださ

Introduction Purpose This course explains how to use Mapview, a utility program for the Highperformance Embedded Workshop (HEW) development environmen

Microsoft Word - Live Meeting Help.docx

Windows Macintosh 18 Java Windows 21 Java Macintosh

untitled

ACS電子ジャーナル利用マニュアル

外部SQLソース入門


LWW EJ on Ovid LWW Ovid Online (Ovid Web Gateway) Ovid Online LWW tutorial Ovid Online Refresh Ovid Online LWW Ovid Medline, Cinahl, EBMR, Ovid



LWW EJ on Ovid LWW Ovid Online (Ovid Web Gateway) Ovid Online LWW tutorial Ovid Online Refresh Ovid Online LWW Ovid Medline, Cinahl, EBMR, Ovid

pp Excel Excel Excel Microsoft Excel 2015 OS Windows7 Excel2010(Microsoft Office2010) Office Excel 2 Excel 33

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

Condition DAQ condition condition 2 3 XML key value

InfoPros13_digest.key

0.2 Button TextBox: menu tab 2

Ver.1 1/17/2003 2

作業手順手引き

MOMW_I_,II 利用ガイド.PDF


help gem gem gem my help

JavaScript 1.! DOM Ajax Shelley Powers,, JavaScript David Flanagan, JavaScript 2

Microsoft Word - KUINS-Air_W10_ docx

206“ƒŁ\”ƒ-fl_“H„¤‰ZŁñ

Web 1990,HTTP, HTML, URL XML HTML XHTML XML Web XMLSOAPWSDL ( ) Web2.0 Web XML+WebAPI

open / window / I / shall / the? something / want / drink / I / to the way / you / tell / the library / would / to / me

携帯電話でGoogle Mapsを使う

ストラドプロシージャの呼び出し方

New version (2.15.1) of Specview is now available Dismiss Windows Specview.bat set spv= Specview set jhome= JAVA (C:\Program Files\Java\jre<version>\

WordPress Web

Lotus Domino XML活用の基礎!

Step 1 Feature Extraction Featuer Extraction Feature Extraction Featuer Extraction Image Analysis Start>Programs>Agilent-Life Sciences>Feature Extract

untitled

d_appendixB-asp10appdev.indd

"CAS を利用した Single Sign On 環境の構築"

6 2 s µ µµµ µµµµ µ µ h µs µ µµµµ µ µ µ s mµµµµµ µµµ µµ µ u m µmµµµµµ µµ µ µ µ µ µ µ µ µ s 1

Specview Specview Specview STSCI(Space Telescope SCience Institute) VO Specview Web page htt

インストール取扱説明書

nfpf2010_10(P14)

ii II Web Web HTML CSS PHP MySQL Web Web CSS JavaScript Web SQL Web

2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa

() < > </ > / HTML SGML HTML 1.1 DTD DTD ( DTD (prolog) )SGML 1. DTD ( ) 2. DTD <!-- DTD-- > <!ELEMENT MAIL - - ((TO,FROM)?,DATE?,BODY) > <!ELEMENT TO

JP1/Integrated Management - Service Support 操作ガイド

lucene-gosen Solr1

-2-

Microsoft Word - MetaFluor70取扱説明.doc


morita.PDF

. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr


13 Student Software TI-Nspire CX CAS TI Web TI-Nspire CX CAS Student Software ( ) 1 Student Software 37 Student Software Nspire Nspire Nspir

untitled

untitled



VE-GP32DL_DW_ZA

29 jjencode JavaScript

Blue Asterisk template

RX600 & RX200シリーズ アプリケーションノート RX用仮想EEPROM

syspro-0405.ppt

(a) (b) 1 JavaScript Web Web Web CGI Web Web JavaScript Web mixi facebook SNS Web URL ID Web 1 JavaScript Web 1(a) 1(b) JavaScript & Web Web Web Webji

HIS-CCBASEver2

How to read the marks and remarks used in this parts book. Section 1 : Explanation of Code Use In MRK Column OO : Interchangeable between the new part

Microsoft Word - PPTP-manual(MacOS)_ _revised(E)

fiš„v3.dvi

Microsoft Word - Meta70_Preferences.doc

How to read the marks and remarks used in this parts book. Section 1 : Explanation of Code Use In MRK Column OO : Interchangeable between the new part

: 1/15( ): HTML web page (2) 1/18( ): (1) 1/25( ): (2) 1

untitled

Cleaner XL 1.5 クイックインストールガイド

How to read the marks and remarks used in this parts book. Section 1 : Explanation of Code Use In MRK Column OO : Interchangeable between the new part

CSS

Transcription:

googlevis-0.6.1 Markus Gesmann *, Diego de Castillo 2016 9 1 2016 9 21 googlevis R Google Google TED Hans Rosling googlevis R Google Google Chart googlevis Google JavaScript HTML googlevis R HTTP Flash * markus.gesmann@gmail.com decastillo@gmail.com arakitkansai-u.ac.jp 1

1 4 1.1...................................... 4 1.2 Google Chart Tools.................................... 4 2 googlevis 6 2.1........................................ 7 2.2 googlevis................................ 8 2.3.................................. 9 2.4 gvis............................ 14 2.5 print.gvis plot.gvis....................... 15 2.6 gvismerge............................. 16 2.7..................................... 17 2.7.1................................... 19 2.7.2....................... 19 3 googlevis 20 3.1 gvis..................... 20 3.2 googlevis WordPress......................... 20 3.3 googlevis Google, Blogger.............. 21 3.4 googlevis....................... 22 3.4.1 googlevis R.rsp............................ 23 3.4.2 RApache brew googlevis..................... 23 3.4.3 Rook googlevis............................ 25 3.4.4 shiny googlevis............................ 26 4 knitr googlevis 28 5 googlevis 30 6 R 31 6.1............................ 31 7 FAQ 32 7.1 googlevis PDF................... 32 7.2............... 32 7.3...................... 32 7.4...................................... 33 7.5 ipad iphone....... 33 7.6 GoogleVis................ 33 7.7................... 33 7.8 googlevis........................ 34 2

7.9......................................... 34 7.10............................................ 34 3

1 1.1 2006 Hans Rosling 50 TED [Ros06] Rosling Gapminder [Fou10b] 1 Rosling 1 Gapminder Google 1 Google Charts API [Inc12e] Google Visualization API 2010 R/Rmetrics Sebastián Peréz Saaibi [Saa10] Google R R.rsp [Ben12] 2010 8 googlevis [GdC12], [GdC11] 1.2 Google Chart Tools Google Charts API [Inc12b] Google API Google Public Data Explorer [Inc12d] HTML Google Charts DataTable [Inc12e] googlevis jsonlite [Oom14] R JSON [JSO06] Data Table Google visualisation gallery [Inc12c] html 1 1 <html> 4

1: Google plot(gvismotionchart(fruits, idvar= Fruit, timevar= Year )) 2 <head> 3 <script type="text/javascript" 4 src="http://www.google.com/jsapi"> 5 </script> 6 <script type="text/javascript"> 7 google.load( visualization, 1, 8 { packages :[ motionchart ]}); 9 google.setonloadcallback(drawchart); 10 function drawchart() { 11 var data=new google.visualization.datatable(); 12 data.addcolumn( string, Fruit ); 13 data.addcolumn( date, Date ); 14 data.addcolumn( number, Sales ); 15 data.addcolumn( number, Expenses ); 16 data.addcolumn( string, Location ); 17 data.addrows([ 18 [ Apples,new Date(1988,0,1),1000,300, East ], 19 [ Oranges,new Date(1988,0,1),1150,200, West ], 20 [ Bananas,new Date(1988,0,1),300,250, West ], 21 [ Apples,new Date(1989,6,1),1200,400, East ], 22 [ Oranges,new Date(1989,6,1),750,150, West ], 23 [ Bananas,new Date(1989,6,1),788,617, West ] 24 ]); 25 var chart=new google.visualization.motionchart( 26 document.getelementbyid( chart_div )); 27 chart.draw(data, {width: 600, height:300}); 5

28 } 29 </script> 30 </head> 31 <body> 32 <div id="chart_div" 33 style="width:600px; height:300px;"> 34 </div> 35 </body> 36 </html> 1 HTML 5 2 ˆ Google AJAX ( 4 ) Visualisation API 7 8 ) ˆ DataTable 11 24 ˆ 25 26 ˆ width height 27 ˆ HTML <div> 32 34 Google Chart Tools 2 API Google Terms of Service [Inc12a] 2 googlevis googlevis R Google Chart Tools R Google Charts 0.6.1 Motion Chart Annotated Time Lines Maps Geo Maps Geo Charts Intensity Maps Tables Gauges Treemap Line Charts Bar Charts Bubble Charts Column Charts Area Charts Stepped Areas Combo Charts Scatter Charts Candlestick Charts Pie Charts Sankey Annotation Histogram Timeline Calender Org Charts 2 3 googlevis Google JavaScript HTML Flush HTML5 1 https://google-developers.appspot.com/chart/interactive/docs/gallery/motionchart.html#data_ Policy 2 https://google-developers.appspot.com/chart/interactive/docs/index 3 http://code.google.com/p/google-motion-charts-with-r/wiki/gadgetexamples 6

2: demo(googlevis) gvismotionchart gvisannotatedtimeline gvisgeomap gvistreemap gvistable gvismap 2.1 googlevis CRAN R> install.packages( googlevis ) library(googlevis) R> library(googlevis) Welcome to googlevis version 0.6.1 Please read the Google API Terms of Use before you start using the package: https://developers.google.com/terms/ Note, the plot method of googlevis will by default use 7

the standard browser to display its output. See the googlevis package vignettes for more details, or visit http://github.com/mages/googlevis. To suppress this message use: suppresspackagestartupmessages(library(googlevis)) 2.2 googlevis googlevis 1 API googlevis 4 gvis + gvismotionchart(data, idvar= id, timevar= date, options=list(), chartid) data idvar timevar id options 17 Google Charts API R> help( gvismotionchart ) chartid id tempfile(pattern= ) id 1 id googlevis id HTML 3 rsp 23 RApache 23 Google googlevis gvis list print print.gvis plot plot.gvis Fruits 4 demo(package="googlevis") 8

3: gis 2.3 Google API 4 1 1 2 Fruits R> data(fruits) R> Fruits Fruit Year Location Sales Expenses Profit Date 1 Apples 2008 West 98 78 20 2008-12-31 2 Apples 2009 West 111 79 32 2009-12-31 3 Apples 2010 West 89 76 13 2010-12-31 4 Oranges 2008 East 96 81 15 2008-12-31 5 Bananas 2008 East 85 76 9 2008-12-31 6 Oranges 2009 East 93 80 13 2009-12-31 7 Bananas 2009 East 94 78 16 2009-12-31 8 Oranges 2010 East 98 91 7 2010-12-31 9 Bananas 2010 East 81 71 10 2010-12-31 id Fruit Year Year Date R> M <- gvismotionchart(fruits, idvar="fruit", timevar="year") gvismotionchart R> str(m) List of 3 $ type : chr "MotionChart" $ chartid: chr "MotionChartID14c805cbd833b" $ html :List of 4..$ header : chr "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0..$ chart : Named chr [1:7] "<!-- MotionChart generated in R 3.....- attr(*, "names")= chr [1:7] "jsheader" "jsdata" "jsdrawch 9

..$ caption: chr "<div><span>data: Fruits Chart ID: <a h..$ footer : chr "\n<!-- htmlfooter -->\n<span> \n R version 3. - attr(*, "class")= chr [1:2] "gvis" "list" 2 type id chartid 5 R> M$type [1] "MotionChart" R> M$chartid [1] "MotionChartID14c805cbd833b" html header chart caption footer html html html R> print(m, tag= header ) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>motionchartid14c805cbd833b</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <style type="text/css"> body { color: #444444; font-family: Arial,Helvetica,sans-serif; font-size: 75%; } a { color: #4D87C7; text-decoration: none; } </style> </head> <body> M$html$header tag tag= header print cat(m$html$header) Google visualisation HTML JavaScript HTML JavaScript id print.gvis 5 10

R> names(m$html$chart) [1] "jsheader" "jsdata" "jsdrawchart" "jsdisplaychart" [5] "jsfooter" "jschart" "divchart" R> print(m, tag= chart ) ## cat(m$html$chart) <!-- MotionChart generated in R 3.3.1 by googlevis 0.6.1 package --> <!-- Thu Sep 1 06:03:33 2016 --> <!-- jsheader --> <script type="text/javascript"> // jsdata function gvisdatamotionchartid14c805cbd833b () { var data = new google.visualization.datatable(); var datajson = [ [ "Apples", 2008, "West", 98, 78, 20, "2008-12-31" ], [ "Apples", 2009, "West", 111, 79, 32, "2009-12-31" ], [ "Apples", 2010, "West", 89, 76, 13, "2010-12-31" ], [ "Oranges", 2008, "East", 96, 11

81, 15, "2008-12-31" ], [ "Bananas", 2008, "East", 85, 76, 9, "2008-12-31" ], [ "Oranges", 2009, "East", 93, 80, 13, "2009-12-31" ], [ "Bananas", 2009, "East", 94, 78, 16, "2009-12-31" ], [ "Oranges", 2010, "East", 98, 91, 7, "2010-12-31" ], [ "Bananas", 2010, "East", 81, 71, 10, "2010-12-31" ] ]; data.addcolumn( string, Fruit ); data.addcolumn( number, Year ); 12

data.addcolumn( string, Location ); data.addcolumn( number, Sales ); data.addcolumn( number, Expenses ); data.addcolumn( number, Profit ); data.addcolumn( string, Date ); data.addrows(datajson); return(data); } // jsdrawchart function drawchartmotionchartid14c805cbd833b() { var data = gvisdatamotionchartid14c805cbd833b(); var options = {}; options["width"] = 600; options["height"] = 500; options["state"] = ""; var chart = new google.visualization.motionchart( document.getelementbyid( MotionChartID14c805cbd833b ) ); chart.draw(data,options); } // jsdisplaychart (function() { var pkgs = window. gvispackages = window. gvispackages []; var callbacks = window. gviscallbacks = window. gviscallbacks []; var chartid = "motionchart"; // Manually see if chartid is in pkgs (not all browsers support Array.indexOf) var i, newpackage = true; 14 for (i = 0; newpackage && i < pkgs.length; i++) { if (pkgs[i] === chartid) newpackage = false; } if (newpackage) pkgs.push(chartid); // Add the drawchart function to the global list of callbacks callbacks.push(drawchartmotionchartid14c805cbd833b); })(); function displaychartmotionchartid14c805cbd833b() { var pkgs = window. gvispackages = window. gvispackages []; var callbacks = window. gviscallbacks = window. gviscallbacks []; window.cleartimeout(window. gvisload); // The timeout is set to 100 because otherwise the container div we are // targeting might not be part of the document yet window. gvisload = settimeout(function() { var pkgcount = pkgs.length; google.load("visualization", "1", { packages:pkgs, callback: function() { 13

if (pkgcount!= pkgs.length) { // Race condition where another settimeout call snuck in after us; if // that call added a package, we must not shift its callback return; } while (callbacks.length > 0) callbacks.shift()(); } }); }, 100); } // jsfooter </script> <!-- jschart --> <script type="text/javascript" src="https://www.google.com/jsapi?callback=displaychartmotion <!-- divchart --> <div id="motionchartid14c805cbd833b" style="width: 600; height: 500;"> </div> jschart R> cat(m$html$chart[ jschart ]) # or print(m, jschart ) <!-- jschart --> <script type="text/javascript" src="https://www.google.com/jsapi?c html html R> print(m, tag= caption ) <div><span>data: Fruits Chart ID: <a href="chart_motioncha R> print(m, tag= footer ) <!-- htmlfooter --> <span> R version 3.3.1 (2016-06-21) <a href="https://developers.google.com/terms/">google Te </span></div> </body> </html> 2.4 gvis R> plot(m) # 14

gvis plot id HTML R HTTP http://127.0.0.1 & id R tempdir() file print html R> print(m, file="mygooglevischart.html") Flush 6 Flush Tony Breyal stackoverflow.com 1. http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_ manager04.html 2. Edit location add location 3. browse for folder 4. HTML 5. OK googlevis HTML plot.gvis HTML /Users/JoeBloggs/myGoogleVisChart.html plot.gvis gvis R HTTP R> plot.gvis("/users/joebloggs/mygooglevischart.html") plot.gvis googlevis 0.3.2 2.5 print.gvis plot.gvis googlevis 0.3.2 print.gvis tag plot.gvis NULL plot tag NULL plot.gvis print.gvis options() tag googlevis options(gvis.print.tag= html ) options(gvis.plot.tag=null) options(gvis.plot.tag= chart ) plot gvis knitr R.rsp R googlevis 6 Flush 15

options(gvis.plot.tag=null) knitr chart plot HTML 4 28 knitr 2.6 gvismerge gvismerge 2 gvis 1 HTML 2 horizontal vertival 4: gvismerge 3 gvismerge gvis gvismerge 4 R> G <- gvisgeochart(exports, "Country", "Profit", + options=list(width=200, height=100)) R> T <- gvistable(exports, + options=list(width=200, height=270)) R> M <- gvismotionchart(fruits, "Fruit", "Year", + options=list(width=400, height=370)) R> GT <- gvismerge(g,t, horizontal=false) R> GTM <- gvismerge(gt, M, horizontal=true, + tableoptions="bgcolor=\"#cccccc\" cellspacing=10") R> plot(gtm) 16

2.7 googlevis 7 Google Charts API options 5 5: > df <- data.frame(country=c("us", "GB", "BR"), + val1=c(1,3,4), val2=c(23,12,32)) > Line <- gvislinechart(df, xvar="country", yvar=c("val1","val2"), + options=list( + title="hello World", + titletextstyle="{color: red, + fontname: Courier, + fontsize:16}", + backgroundcolor="#d3d3d3", + vaxis="{gridlines:{color: red, count:3}}", + haxis="{title: Country, titletextstyle:{color: blue }}", + series="[{color: green, targetaxisindex: 0}, + {color: orange,targetaxisindex:1}]", + vaxes="[{title: val1 }, {title: val2 }]", + legend="bottom", + curvetype="function", + width=500, + height=300 + )) > plot(line) = width=500 { } 2 7 googlevis 17

[ ] ˆ. width height R options=list(width=200, height=300). R TRUE FALSE ˆ. color [ ] options=list(colors="[ #cbb69d, #603913, #c69c6e ]") ˆ. {} parameter: value true false Google vaxis.format R options=list(vaxis="{format: #,###% }") ˆ titletextstyle.color, title-textstyle.fontname titletextstyle.fontsize options=list( titletextstyle="{color: red,fontname: Courier, fontsize:16}") ˆ [ ] options=list(vaxes="[{title: val1 }, {title: val2 }]") 6 R> Geo <- gvisgeochart(citypopularity, locationvar= City, + colorvar= Popularity, + options=list(region= US, height=350, + displaymode= markers, + coloraxis="{values:[200,400,600,800], + colors:[\ red, \ pink\, \ orange,\ green ]}") + ) R> plot(geo) 6: 18

2.7.1 gvis.editor 7 gvis.editor Edit me! 8 R> Editor <- gvislinechart(df, options=list(gvis.editor= Edit me! )) R> plot(editor) 7: options = list (gvis.editor = Edit me! ) googlevis 2.7.2 googlevis JSON JSON 4 12 16 2 9 8 R> df <- data.frame("year"=c("2009", "2010"), "Lloyd\\ s"=c(86.1, 93.3), "Munich\\ Res R/I"=c(95.3, 100.5), check.names=false) R> df Year Lloyd\\ s Munich\\ Res R/I 1 2009 86.1 95.3 8 https://google-developers.appspot.com/chart/interactive/docs/drawing_charts#charteditor 9 1 "Year"=c(2009, 2010) "Year"=c("2009", "2010") 19

2 2010 93.3 100.5 R> CR <- gviscolumnchart(df, options=list(vaxis= {baseline:0}, title="combined Ratio %", legend="{position: bottom }")) R> plot(cr) 8: 3 googlevis 3.1 gvis googlevis gvismotionchart gvismotionchart Rconsole R> print(m, chart ) ## cat(m$html$chart) html & R> print(m, chart, file= myfilename ) 3.2 googlevis WordPress WordPress googlevis WordPress WordPress JavaScript googlevis 20

WordPress JavaScript WordPress 1 custom fields shortcode 10 googlevis R R> M <- gvismotionchart(fruits, "Fruit", "Year", + options=list(width=400, height=370)) R> print(m, chart ) WordPress value Fruits [cf]fruits[/cf] 9 9: googlevis WordPress 3.3 googlevis Google, Blogger Google Google Google Blogger Google Code wiki pages Google Google XML HTML Javascript Google Hello World Wikipedia 10 http://wordpress.org/extend/plugins/custom-fields-shortcode 21

<?xml version="1.0" encoding="utf-8"?> <Module> <ModulePrefs title="simple hello world example" /> <Content type="html"> <![CDATA[ Hello, world! ]]> </Content> </Module> googlevis creategooglegadget gvis XML R> M <- gvismotionchart(fruits, "Fruit", "Year") R> G <- creategooglegadget(m) R> cat(g, file="mygadget.xml") Google Docs mygadget.xml URL http://example.com/mygadget.xml Google Site ˆ Google Site "Insert" -> "More gadgets..." -> "Add gadget URL", ˆ wiki:gadget Google Code wiki <wiki:gadget url="http://example.com/gadget.xml" />, ˆ Blogger blogger post googlevis post & googlevis Dropbox <iframe> <iframe width="100%" height="400px" frameborder="0" src="http://example.com/mygooglevischart.html"> </iframe> http://www.magesblog.com/2011/09/including-googlevis-output-into-blogg htm 3.4 googlevis googlevis R R.rsp [Ben12] brew [Hor11a] R HTML R.rsp brew 22

RApache [Hor11b] Apache HTTP [Fou10a] RApache UNIX/Linux Mac OS X R 2.11.0 R Rook [Hor13] shiny [Rl13] 2 shiny R googlevis 3.4.1 googlevis R.rsp R.rsp R html R R.rsp rsp <html> <body> <% library(googlevis) M <- gvismotionchart(fruits, idvar="fruit", timevar="year") %> <%= M$html$chart %> </body> </html> R <%=...%> R R.rsp HTTP R html R <\%=...\%> cat googlevis R R> library(r.rsp) R> browsersp() R> # googlevis rsp googlevis R> file.path(system.file("rsp", package = "googlevis"), "index.rsp") R.rsp 3.4.2 RApache brew googlevis RApache R Apache HTTP RApache Apache R R HTML R brew HTTP brew brew R RApache R.rsp 2 R RApache http://rapache.net/manual. html Mac OS X http://-worldofrcraft.blogspot. com/2010/08/installing-rapache-on-mac-os-x-snow.html 23

RApache RApache Apache apache2.conf httpd.conf /etc/httpd Mac OS X /etc/httpdor/private/etc/apache2/httpd LoadModule R_module /usr/lib/apache2/modules/mod_r.so ## On Mac OS X more likely to be: ## LoadModule R_module libexec/apache2/mod_r.so ROutputErrors RSourceOnStartup "/var/www/rapache/r/startup.r" ## On Mac OS X the www folder is often equivalent to: ## /Library/WebServer/Documents/ 1 Apache R 2 startup.r ## Ensure the packages are installed so that mod_r ## has access to them, e.g. not in your home folder library{googlevis} library{lattice} library{cairo} MyGlobalVar <- 42 RApache http://localhost/rapacheinfo RApache http://biostat.mc.vanderbilt. edu/rapache/files/rapacheinfo.html brew R R> install.packages( brew ) brew Apache apache2.conf httpd.conf RHandler brew <Directory /var/www/rapache/brew> ## On Mac OS more likely to be something like: ## <Directory /Library/WebServer/Documents/rapache/brew> SetHandler r-script RHandler brew::brew </Directory> HTTP brew http://localhost/rapache/brew/filename <html> <body> <h1>fruits</h1> <% library(googlevis) M <- gvismotionchart(fruits, idvar="fruit", timevar="year") %> <%= M$html$chart %> </body> 24

</html> brew rsp RApache brew brew googlevis 2 R R> system.file("brew", package = "googlevis") 3.4.3 Rook googlevis Rook [Hor13] Jeffrey Horner RApache brew R Rook Rook R R HTTP Rook Rook HTTP Rook R googlevis Edit me! CSV 10 10: googlevis Rook R> require(rook) R> require(googlevis) R> s <- Rhttpd$new() R> s$start(listen= 127.0.0.1 ) R> my.app <- function(env){ + ## Start with a table and allow the user to upload a CSV-file 25

+ req <- Request$new(env) + res <- Response$new() + + ## Provide some data to start with + ## Exports is a sample data set of googlevis + data <- Exports[,1:2] + ## Add functionality to upload CSV-file + if (!is.null(req$post())) { + ## Read data from uploaded CSV-file + data <- req$post()[["data"]] + data <- read.csv(data$tempfile) + } + ## Create table with googlevis + tbl <- gvistable(data, + options=list(gvis.editor="edit me!", + height=350), + chartid="myinitialview") + ## Write the HTML output and + ## make use of the googlevis HTML output. + ## See vignette( googlevis ) for more details + res$write(tbl$html$header) + res$write("<h1>my first Rook app with googlevis</h1>") + res$write(tbl$html$chart) + res$write( + Read CSV file:<form method="post" enctype="multipart/form-data"> + <input type="file" name="data"> + <input type="submit" name="go">\n</form> ) + res$write(tbl$html$footer) + res$finish() + } R> s$add(app=my.app, name= googlevistable ) R> ## R> s$browse( googlevistable ) 3.4.4 shiny googlevis shiny 11 RStudio shiny R googlevis 0.4.0 shiny [Rl13] Joe Cheng rendergvis googlevis shiny shiny 0.4.0 rendergvis 11 R> # server.r R> library(googlevis) R> shinyserver(function(input, output) { 11 http://www.rstudio.com/shiny/ 26

11: googlevis shiny + datasetinput <- reactive({ + switch(input$dataset, + "rock" = rock, + "pressure" = pressure, + "cars" = cars) + }) + + output$view <- rendergvis({ + gvisscatterchart(datasetinput()) + }) + }) R> # ui.r R> shinyui(pagewithsidebar( + headerpanel("googlevis on Shiny"), + sidebarpanel( + selectinput("dataset", "Choose a dataset:", + choices = c("rock", "pressure", "cars")) + ), + mainpanel( + htmloutput("view") + ) 27

+ )) R> library(shiny) ## 0.4.0 R> runapp(system.file("shiny/", package="googlevis")) Markus blog:http://www.magesblog.co.uk/search/label/shiny 4 knitr googlevis knitr 12 [Xie13] googlevis knitr Sweave R knitr googlevis HTML googlevis knitr chunk results asis {r results= asis } M <- gvismotionchart(fruits, "Fruit", "Year", options=list(width=550, height=450)) print(m, chart ) http://www.magesblog.co.uk/2012/05/interactive-reports-in-r-with-knitr-and. html googlevis 0.3.2 plot.gvis tag 15. NULL options() plot tag plot tag print.gvis options(gvis.plot.tag = chart ) plot print plot() x gvis print(x, tag= chart ) knitr Rmd gvis.plot.tag chart plot html 12 # Markdown example with knitr and googlevis =========================================== This is a little Markdown example file. Set the googlevis options first. In this case change the behaviour of plot.gvis {r setoptions, message=false} library(googlevis) op <- options(gvis.plot.tag= chart ) 12 http://yihui.name/knitr/ 28

12: plot HTML ## {r ComboExample, results= asis, tidy=false} ## CityPopularity$Mean=mean(CityPopularity$Popularity) CC <- (CityPopularity, xvar= City, yvar=c( Mean, Popularity ), options=list(seriestype= bars, width=450, height=300, title= City Popularity, series= {0: {type:\"line\"}} )) plot(cc) \R gviscombochart ## 2 {r gvismergeexample, results= asis, echo=false} Geo <- gvisgeochart(exports, locationvar= Country, colorvar= Profit, options=list(height=300, width=350)) Tbl <- gvistable(exports, options=list(height=300, width=200)) 29

plot(gvismerge(geo, Tbl, horizontal=true)) gvistable gvisgeochart \R ## {r MotionChartExample, results= asis, tidy=false} M <- gvismotionchart(fruits, Fruit, Year, options=list(width=400, height=350)) plot(m) [security settings of Macromedia] googlevis {r resetoptions} ## options(op) knitr options() R R &?plot.gvis 5 googlevis Google Chart Tools googlevis MS PowerPoint 13 Google Docs OpenOffice Impress Apple Keynot Ramnath Vaidyanathan [Vai12] slidify knitr slidify 2013 user! googlevis [GdC13] slidify slidify R Dropbox github 13 MS-Windows Microsoft PowerPoint liveweb PowerPoint 30

13: 2013 user! googlevis http://decastillo.github.io/googlevis Tutorial 6 R R 6.1 Google visualisations 14 2 JavaScript ˆ google.visualization.events.trigger() ˆ google.visualization.events.addlistener() Google 1 var table = new google.visualization.table(document.getelementbyid( table_div )); table.draw(data, options); google.visualization.events.addlistener(table, select, selecthandler); function selecthandler() { alert( A table row was selected ); } addlistner select addlistener gvis.listener.jscode gvis JavaScript Wikipedia R> jscode <- "window.open( http://en.wikipedia.org/wiki/ + + data.getvalue(chart.getselection()[0].row,0)); " 14 http://code.google.com/apis/chart/interactive/docs/reference.html#addlistener 31

R> J1 <- gvisgeomap(exports, locationvar= Country, numvar= Profit, + options=list(datamode="regions", gvis.listener.jscode=jscode)) R> plot(j1) R> plot(gvisorgchart(regions, options=list(gvis.listener.jscode=jscode))) R> plot(gvislinechart(regions[,c(1,3)], options=list(gvis.listener.jscode=jscode))) R> jscode <- " + var sel = chart.getselection(); + var row = sel[0].row; + var text = data.getvalue(row,1); + alert(text); + " R> J2 <- gvistable(population, options=list(gvis.listener.jscode=jscode)) R> plot(j2) demo(eventlistener) Google Charts 7 FAQ 7.1 googlevis PDF Google Charts API googlevis 5 30 googlevis PNG Google 7.2 Google Charts API 7.3 gvismap Google Fusion Table Google Fusion Table http://support.google.com/fusiontables/answer/2679986?hl=en 32

7.4 2.4 14 7.5 ipad iphone HTML5 Flash ipads iphones ios Flash Google HTML5 Google Visualizetion API http://goo.gl/5zyuw 7.6 GoogleVis ylim cxlim Google haxes vaxes h horizontal v vertical viewwindowmode explicit viewwindow h/vaxes [{ }] minvalue maxvalue y 0 10 R> library(googlevis) R> dat <- data.frame(x=letters[1:10], + y=c(0, 4, -2, 2, 4, 3, 8, 15, 10, 4)) R> area1 <- gvisareachart(xvar="x", yvar="y", data=dat, + options=list(vaxes="[{viewwindowmode: explicit, + viewwindow:{min:0, max:10}}]", + width=500, height=400, + title="y-limits set from 0 to 10"), + chartid="area1ylim") R> plot(area1) 7.7 googlevis Google Charts API Google Visualization API http://groups.google. com/group/google-visualization-api API API check https://developers.google.com/chart/ interactive/faq 33

7.8 googlevis Google https://developers.google.com/terms/ IT Google 7.9 googlevis https://github.com/ mages/googlevis/issues 7.10 R googlevis R> citation("googlevis") R> citation() [Ben12] Henrik Bengtsson. R.rsp: R server pages. http://cran.r-project.org/package=r.rsp, 2012. R package version 0.8.2. [Fou10a] Apache Foundation. Apache HTTP Server 2.2. http://httpd.apache.org, 2010. [Fou10b] Gapminder Foundation. Gapminder. http://www.gapminder.org, 2010. [GdC11] Markus Gesmann and Diego de Castillo. Using the Google Visualisation API with R. The R Journal, 3(2):40-44, December 2011. [GdC13] Markus Gesmann and Diego de Castillo. googlevis Tutorial, 2013. [GdC14] Markus Gesmann and Diego de Castillo. googlevis: Using the Google Chart Tools with R. http://github.com/mages/googlevis, 2014. R package version 0.5.8. [Hor11a] Jeffrey Horner. brew: Templating framework for report generation. http://cran. R-project.org/package=brew, 2011. R package version 1.0-6. [Hor11b] Jeffrey Horner. RApache: Web application development with R and Apache. http: //www.rapache.net/, 2011. [Hor13] Jeffrey Horner. Rook: Rook - a web server interface for R, 2013. R package version 1.0-9. [Inc12a] Google Inc. Google API Terms of Service. https://developers.google.com/terms/, 2012. [Inc12b] Google Inc. Google Chart Tools. https://google-developers.appspot.com/chart/ interactive/docs/gallery, 2012. [Inc12c] Google Inc. Google Motion Chart API. https://google-developers.appspot.com/ chart/interactive/docs/gallery/motionchart.html, 2012. 34

[Inc12d] Google Inc. Google Public Data Explorer. http://www.google.com/publicdata/home, 2012. [Inc12e] Google Inc. Google Visualisation Reference. https://developers.google.com/chart/ interactive/docs/reference, 2012. [JSO06] JSON.org. JSON. http://www.json.org/, 2006. RFC 4627 application/json. [Oom14] Jeroen Ooms. The jsonlite package: A practical and consistent mapping between json data and r objects. arxiv:1403.2805 [stat.co], 2014. [Lan12] Duncan Temple Lang. RJSONIO: Serialize R objects to JSON, JavaScript Object Notation. http://www.omegahat.org/rjsonio/, 2012. R package version 1.0-1. [RI13] RStudio and Inc. shiny: Web Application Framework for R, 2013. R package version 0.4.0. [Ros06] Hans Rosling. TED Talk: Hans Rosling shows the best stats you ve ever seen. http://www. ted.com/talks/hans_rosling_shows_the_best_stats_you_ve_ever_seen.html, 2006. [Saa10] Sebastián Peŕez Saaibi. R/RMETRICS Generator Tool for Google Motion Charts. https: //www.rmetrics.org/, 2010. Meielisalp, Lake Thune Switzerland, June 27 - July 1, 2010. [Vai12] Ramnath Vaidyanathan. slidify: Generate reproducible html5 slides from R markdown, 2012. R package version 0.3.3. [Xie13] Yihui Xie. knitr: A general-purpose package for dynamic report generation in R, 2013. R package version 1.1. 35