Apple Motion 1.0.1 User Manual

Browse online or download User Manual for Software Apple Motion 1.0.1. Using the Google Chart Tools with R: googleVis [en]

  • Download
  • Add to my manuals
  • Print
  • Page
    / 41
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 0
Using the Google Chart Tools with R:
googleVis-0.5.8 Package Vignette
Markus Gesmann
, Diego de Castillo
January 21, 2015
Abstract
The googleVis package provides an interface between R and the Google
Charts API. Google Charts offer interactive charts which can be embedded
into web pages. The best known of these charts is probably the Motion Chart,
p opularised by Hans Rosling in his TED talks.
The functions of the googleVis package allow the user to visualise data
stored in R data frames with Google Charts without uploading the data to
Go ogle. The output of a googleVis function is html code that contains the
data and references to JavaScript functions hosted by Google.
googl eVis makes use of the internal R HTTP server to display the output
lo cally. A modern browser with an Internet connection is required and for
some charts a Flash player.
1
Page view 0
1 2 3 4 5 6 ... 40 41

Summary of Contents

Page 1 - January 21, 2015

Using the Google Chart Tools with R:googleVis-0.5.8 Package VignetteMarkus Gesmann∗, Diego de Castillo†Contact: [email protected] 21, 20

Page 2 - Contents

2.3 Motion Chart ExampleFollowing the documentation of the Google Motion Chart API we need a dataset which has at least four columns: one identifying

Page 3

R> M$type[1] "MotionChart"R> M$chartid[1] "MotionChartID212d6d31dc7d"The html output is a list with header, chart, caption a

Page 4 - 1 Introduction

[1] "jsHeader" "jsData" "jsDrawChart" "jsDisplayChart"[5] "jsFooter" "jsChart" "divCh

Page 5

],["Oranges",2008,"East",96,81,15,"2008-12-31"],["Bananas",2008,"East",85,76,9,"2008-12-31"

Page 6 - 2 The googleVis package

["Bananas",2010,"East",81,71,10,"2010-12-31"]];data.addColumn('string','Fruit');data.addColumn(&apos

Page 7

var i, newPackage = true;for (i = 0; newPackage && i < pkgs.length; i++) {if (pkgs[i] === chartid)newPackage = false;}if (newPackage)pkgs.p

Page 8 - 2.1 Installation

R> cat(M$html$chart['jsChart']) # or print(M, 'jsChart')<!-- jsChart --><script type="text/javascript" src=&

Page 9

1. Go to http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html2. Click on the dropbox which says ’Edit location’

Page 10 - 2.3 Motion Chart Example

2.6 Combining charts with gvisMergeThe function gvisMerge takes two gvis-objects and merges the underlying com-ponents into one page. The charts are a

Page 11

2.7 Setting optionsSetting the various options of a googleVis objects can be a bit cumbersome atfirst. The options follow those of the Google Charts AP

Page 12

Contents1 Introduction 41.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2 Google Chart Tools . . . . . . . . . . . . .

Page 13

+ ))R> plot(Line)As you can see from the example above, the simpler options can be set by name=value,e.g. width=500, while the more complex options

Page 14

Figure 6: A geo chart with options set for a colour axis.2.7.1 Chart EditorA special option for all charts is gvis.editor, which adds an edit button t

Page 15

Figure 7: Example of googleVis chart with options = list (gvis.editor =’Edit me!’).Year Lloyd\\'s Munich Re\\'s R/I1 2009 86.1 95.32 2010 93

Page 16

Figure 8: Visualising data with apostrophes in column names.R> print(M, 'chart', file='myfilename')and process it from there.3.

Page 17

Figure 9: Including googleVis output in a WordPress blog entry.and paste it into the value text area of a custom field in WordPress, e.g. with in-stanc

Page 18

R> M <- gvisMotionChart(Fruits, "Fruit", "Year")R> G <- createGoogleGadget(M)R> cat(G, file="myGadget.xml"

Page 19 - 2.7 Setting options

3.4.1 Using googleVis with R.rspThe R.rsp package allows the user to integrate R code into html code. The Rcode is parsed by the R.rsp web server and

Page 20

Detailed installation instructions for RApache are available on the project site:http://rapache.net/manual.html, for specific comments on Mac OS X see:

Page 21

That’s all. Restart the HTTP daemon and you can start placing files in the brewdirectory and access them via http://localhost/rapache/brew/filename, e.

Page 22

Figure 10: Screen shot of a Rook app with googleVis output.+ data <- Exports[,1:2]+ ## Add functionality to upload CSV-file+ if (!is.null(req$POST(

Page 23

7 Frequent ask questions – FAQ 377.1 Can I use googleVis output in PDF files? . . . . . . . . . . . . . . . 377.2 Can I change the colour of the bubble

Page 24

+ <input type="submit" name="Go">\n</form>')+ res$write(tbl$html$footer)+ res$finish()+ }R> s$add(app=my.app,

Page 25

+ htmlOutput("view")+ )+ ))Figure 11: Screen shot a shiny app with googleVis output.You can run the example locally with the following state

Page 26

4 Using googleVis with knitrUsing googleVis with knitr9[Xie13] is a convient way of creating interactivereproducible reports. The approach taken by kn

Page 27

Figure 12: Screen shot of the markdown example output## Combo chart```{r ComboExample, results='asis', tidy=FALSE}## Add the meanCityPopular

Page 28

## Place two charts next to each other```{r gvisMergeExample, results='asis', echo=FALSE}Geo <- gvisGeoChart(Exports, locationvar='C

Page 29

An alternative would be to build the presentation as a web page itself.A popular approach here is the slifiy package by Ramnath Vaidyanathan, [Vai12]t

Page 30

table.draw(data, options);google.visualization.events.addListener(table, 'select', selectHandler);function selectHandler() {alert('A ta

Page 31

7 Frequent ask questions – FAQ7.1 Can I use googleVis output in PD F files?No, not directly.The Google Charts API is designed for dynamic web output on

Page 32 - 4 Using googleVis with knitr

7.6 How can I set axes limits with googleVis?Unfortunately, there are no arguments such as ylim an d xlim. Instead, the GoogleCharts axes options are

Page 33

issues/list8 Contact8.1 CollaborationObviously, the package is work in progress and there are many other functions ofthe Google Charts A PI which are

Page 34

1 Introduction1.1 MotivationMore and more data is becoming available, and yet stories and insights are still oftenmissed: we are lost in the data jung

Page 35 - 6 Beyond R

[GdC13] Markus Gesmann and Diego de Castillo. googleVis Tutorial, 2013.[GdC14] Markus Gesmann and Diego de Castillo. go ogleVis: Using the GoogleChart

Page 36

[Xie13] Yihui Xie. knitr: A general-purpose package for dynamic report generationin R, 2013. R package version 1.1.41

Page 37

Y-axisClick here to select indicators for the y-axis.Lin / Log scaleX- and y-axis scales can be linear or logarithmic. A log scale can make it easier

Page 38 - 7.9 Bugs and issues

18 ['Apples',new Date(1988,0,1),1000,300,'East'],19 ['Oranges',new Date(1988,0,1),1150,200,'West'],20 ['B

Page 39 - References

Figure 2: Screenshot of some of the outputs of demo(googleVis). Clock-wise from top left: gvisMotionChart, gvisAnnotatedTimeLine, gvisGeoMap,gvisTreeM

Page 40

2.1 InstallationYou can install googleVis in the usual way from CRAN, e.g.:R> install.packages('googleVis')The installation was successfu

Page 41

Figure 3: Schematic structure of a gvis list object.data requirements follow those of the Google Charts API and are documented inthe help pages, seeR&

Comments to this Manuals

No comments