shiny

Fantastic presentations from R using slidify and rCharts

Ramnath Vaidynathan presenting in DCDr. Ramnath Vaidyanathan of McGill University gave an excellent presentation at a joint Data Visualization DC/Statistical Programming DC event on Monday, August 19 at nclud, on two R projects he leads -- slidify and rCharts. After the evening, all I can say is, Wow!! It's truly impressive to see what can be achieved in presentation and information-rich graphics directly from R. Again, wow!! (I think many of the attendees shared this sentiment)

Slidify

Slidify is a R package that

helps create, customize and share elegant, dynamic and interactive HTML5 documents through R Markdown.

We have blogged about slidify, but it was great to get an overview of slidify directly from the creator. Dr. Vaidyanathan explained that the underlying principle in developing slidify is the separation of the content and the appearance and behavior of the final product. He achieves this using HTML5 frameworks, layouts and widgets which are customizable (though he provides several here and through his slidifyExamples R package).

Example RMarkdown file for slidify

You start with a modified R Markdown file as seen here. This file can have chunks of R code in it. It is then processed to a pure Markdown file, interlacing the output of R code into the file. This is then split-apply-combined to produce the final HTML5 document. This document can be shared using GitHub, Dropbox or RPubs directly from R. Dr. Vaidyanathan gave examples of how slidify can even be used to create interactive quizzes or even interactive documents utilizing slidify and Shiny.

One really neat feature he demonstrated is the ability to embed an interactive R console within a slidify presentation. He explained that this used a Shiny server backend locally, or an OpenCPU backend if published online. This feature changes how presentations can be delivered, by not forcing the presenter to bounce around between windows but actually demonstrate within the presentations.

rCharts

rCharts is

an R package to create, customize and share interactive visualizations, using a lattice-like formula interface

Again, we have blogged about rCharts, but there have been several advances in the short time since then, both in rCharts and interactive documents that Dr. Vaidyanathan has developed.

rCharts creates a formula-driven interface to several Javascript graphics frameworks, including NVD3, Highcharts, Polycharts and Vega. This formula interface is familiar to R users, and makes the process of creating these charts quite straightforward. Some customization is possible, as well as putting in basic controls without having to use Shiny. We saw several examples of excellent interactive charts using simple R commands. There is even a gallery where users can contribute their rCharts creations. There is really no excuse any more for avoiding these technologies for visualization, and it makes life so much more interesting!!

Bikeshare maps, or how to create stellar interactive visualizations using R and Javascript

Dr. Vaidyanathan demonstrated one project which, I feel, shows the power of the technologies he is developing using R and Javascript. He created a web application using R, Shiny, his rCharts packages which accesses the Leaflet Javascript library, and a very little bit of Javascript magic to visualize the availability of bicycles at different stations in a bike sharing network. This application can automatically download real-time data and visualize availability in over 100 bike sharing systems worldwide. He focused on the London bike share map, which was fascinating in that it showed how bikes had moved from the city to the outer fringes at night. Clicking on any dot showed how many bikes were available at that station.

London Bike Share map Dr. Vaidyanathan quickly demonstrated a basic process of how to map points on a city map, how to change their appearance and how to add additional meta-data to each point, that will appear as a pop-up when clicked.

You can see the full project and how Dr. Vaidyanathan developed this application here.

Interactive learning environments

Finally, Dr. Vaidyanathan showed a new application he is developing using slidify, rCharts, and other open-source technologies like OpenCPU and PopcornJS. This application allows him to author a lesson in R Markdown, integrate interactive components including interactive R consoles, record the lesson as a screencast, sync the screencast with the slides, and publish it. This seems to me to be one possible future for presenting massive online courses. An example presentation is available here, and the project is hosted here

Open presentation

The presentation and all the relevant code and demos are hosted on GitHub, and the presentation can be seen (developed using slidify, naturally) here.

Stay tuned for an interview I did with Dr. Vaidyanathan earlier, which will be published here shortly.

Have fun using these fantastic tools in the R ecosystem to make really cool, informative presentations of your data projects. See you next time!!!

Data Visualization: Shiny Democratization

In organizing Data Visualization DC we focus on three themes: The Message, The Process, The Psychology. In other words, ideas and examples of what can be communicated, the tools and know-how to get it done, and how best to communicate. We know intuitively and from experience that the best communication comes in the form of visualizations, and we know there are certain approaches that are more effective than others. What is it about certain visualizations that stimulate memory? Perhaps because we're naturally visual creatures, perhaps visuals allow multiple ideas to be associated with one object, perhaps visuals bring people together and create a common reference for further fluid discussion. Let's explore these ideas.

Rembrant&MemoryVisualization is the Natural Medium

No one really has the answer.  The best visualizers have traditionally been artists, and we know that any given artwork speaks to some and not to others.  Visualizations help you think in new ways, make you ask new questions, but each person will ask different questions and there is no one size fits all.  Visualizations will help you have a conversation without even speaking, much the way Khan Academy allows study on your own time.  Trying to turn this into a science is a noble effort, and articles like "The eyes have it" do an excellent job outlining the cutting edge, but when we have to use visualizations to conduct our work more efficiently we know the first question in communicating is "who's the audience?"  There are certainly best practices (no eye charts, good coloring, associated references, etc.) but the same information will vary in its presentation for each audience.

FoodVizCase in point, everyone has to eat, everyone knows food from their perspective, so if we want to communicate nutrition facts why not know use your audience's craving for delicious looking food to draw them into exploring the visualization.  Fat or Fiction  does an excellent job of this, and I can tell you I never would have known cottage cheese had such a low nutritional value next to cheddar if they weren't juxtaposed for easy comparison.

Ultimately there is a balance and “If you focus more attention on one part of the data, you are ultimately taking attention away from another part of the data,” explains Amitabh Varshney, director of the Institute for Advanced Computer Studies at the University of Maryland, US.  You can attempt to optimize this by hacking your learning, but if you're as curious as I am you need some way of exploring memory on a regular basis to learn for yourself, it shouldn't have to be a never-ending checklist of best practices.

HarlemShake_feb_7_8

Personally I believe that social memes are an example of societal memory, they shape and define our culture giving us objects to reference in conversation.  Looking at the relationships in the initial force-graph presentation of the meme, I can't help but think of neural patterns, the basis of our own memory.  We're all familiar with this challenge when we meet someone from another country, or another generation, and we draw an analogy with a favorite movie, song, actor, etc.; If the person is familiar with the social meme the reference immediately invokes thoughts and memories, which we use to continue the flow of the conversation and introduce new ideas.  The Harlem Shake: anatomy of a viral meme captures how memes emerge over time, and allows you to drill down all the way to what actions people took in different contexts.  My goal in studying this chart is to come away with how to introduce ideas for each audience, through visualizations or otherwise, to maximum information retention.