Interactive Web-Based Data Visualization with R, plotly, and shiny
eBook - ePub

Interactive Web-Based Data Visualization with R, plotly, and shiny

  1. 12 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Interactive Web-Based Data Visualization with R, plotly, and shiny

Book details
Book preview
Table of contents
Citations

About This Book

The richly illustrated Interactive Web-Based Data Visualization with R, plotly, and shiny focuses on the process of programming interactive web graphics for multidimensional data analysis. It is written for the data analyst who wants to leverage the capabilities of interactive web graphics without having to learn web programming. Through many R code examples, you will learn how to tap the extensive functionality of these tools to enhance the presentation and exploration of data. By mastering these concepts and tools, you will impress your colleagues with your ability to quickly generate more informative, engaging, and reproducible interactive graphics using free and open source software that you can share over email, export to pdf, and more.

Key Features:



  • Convert static ggplot2 graphics to an interactive web-based form


  • Link, animate, and arrange multiple plots in standalone HTML from R


  • Embed, modify, and respond to plotly graphics in a shiny app


  • Learn best practices for visualizing continuous, discrete, and multivariate data


  • Learn numerous ways to visualize geo-spatial data

This book makes heavy use of plotly for graphical rendering, but you will also learn about other R packages that support different phases of a data science workflow, such as tidyr, dplyr, and tidyverse. Along the way, you will gain insight into best practices for visualization of high-dimensional data, statistical graphics, and graphical perception. The printed book is complemented by an interactive website where readers can view movies demonstrating the examples and interact with graphics.

Frequently asked questions

Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Interactive Web-Based Data Visualization with R, plotly, and shiny by Carson Sievert in PDF and/or ePUB format, as well as other popular books in Economics & Statistics for Business & Economics. We have over one million books available in our catalogue for you to explore.

Information

Year
2020
ISBN
9780429824203
Edition
1

1

Introduction

1.1 Why interactive web graphics from R?

As Wickham and Grolemund (2016) argue, the exploratory phase of a data science workflow (Figure 1.1) requires lots of iteration between data manipulation, visualization, and modeling. Achieving these tasks through a programming language like R offers the opportunity to scale and automate tasks, document and track them, and reliably reproduce their output. That power, however, typically comes at the cost of increasing the amount of cognitive load involved relative to a GUI-based system.1 R packages like the tidyverse have been incredibly successful due to their ability to limit cognitive load without removing the benefits of performing analysis via code. Moreover, the tidyverseā€™s unifying principles of designing for humans, consistency, and composability make iteration within and between these stages seamless ā€“ an important but often overlooked challenge in exploratory data analysis (EDA) (Tidyverse team, 2018).
Image
FIGURE 1.1: The stages of a data science workflow from Wickham and Grolemund (2016).
In fact, packages within the tidyverse such as dplyr (transformation) and ggplot2 (visualization) are such productive tools that many analysts use static ggplot2 graphics for EDA. Then, when it comes to communicating results, some analysts switch to another tool or language altogether (e.g., JavaScript) to generate interactive web graphics presenting their most important findings (Yau, 2016; Quealy, 2013). Unfortunately, this requires a heavy context switch that requires a totally different skillset and impedes productivity. Moreover, for the average analyst, the opportunity costs involved with becoming competent with the complex world of web technologies is simply not worth the required investment.
Even before the web, interactive graphics were shown to have great promise in aiding the exploration of high-dimensional data (Cook et al., 2007). The ASA maintains an incredible video library, http://statgraphics.org/movies/, documenting the use of interactive statistical graphics for tasks that otherwise wouldnā€™t have been easy or possible using numerical summaries and/or static graphics alone. Roughly speaking, these tasks tend to fall under three categories:
ā€¢ Identifying structure that would otherwise go missing (Tukey and Fisherkeller, 1973).
ā€¢ Diagnosing models and understanding algorithms (Wickham et al., 2015).
ā€¢ Aiding the sense-making process by searching for information quickly without fully specified questions (Unwin and Hofmann, 1999).
Today, you can find and run some of these and similar Graphical User Interface (GUI) systems for creating interactive graphics: DataDesk https://datadescription.com/, GGobi http://www.ggobi.org/, Mondrian http://www.theusrus.de/Mondrian/, JMP https://www.jmp.com, Tableau https://www.tableau.com/. Although these GUI-based systems have nice properties, they donā€™t gel with a code-based workflow: any tasks you complete through a GUI likely canā€™t be replicated without human intervention. That means, if at any point, the data changes, and analysis outputs must be regenerated, you need to remember precisely how to reproduce the outcome, which isnā€™t necessarily easy, trustworthy, or economical. Moreover, GUI-based systems are typically ā€˜closedā€™ systems that donā€™t allow themselves to be easily customized, extended, or integrated with another system.
Programming interactive graphics allows you to leverage all the benefits of a code-based workflow while also helping with tasks that are difficult to accomplish with code alone. For an example, if you were to visualize engine displacement (displ) versus miles per gallon (hwy) using the mpg dataset, you might wonder: ā€œwhat are these cars with an unusually high value of hwy given their displ?ā€. Rather than trying to write code to query those observations, it would be easier and more intuitive to draw an outline around the points to query the data behind them.
library(ggplot2)
ggplot(mpg, aes(displ, hwy)) + geom_point()
Image
FIGURE 1.2: A scatterplot of engine displacement versus miles per gallon made with the ggplot2 package.
Figure 1.3 demonstrates how we can transform Figure 1.2 into an interactive version that can be used to query and inspect points of interest. The framework that enables this kind of linked brushing is discussed in depth within Section 16.1, but the point here is that the added effort required to enable such functionality is relatively small. This is important, because although interactivity can augment exploration by allowing us to pursue follow-up questions, itā€™s typically only practical when we can create and alter them quickly. Thatā€™s because, in a true exploratory setting, you have to make lots of visualizations, and investigate lots of follow-up questions, before stumbling across something truly valuable.
library(plotly)
m < ā€“ highlight_key(mpg)
P < ā€“ ggplot(m, aes(displ, hwy)) + geom_point()
gg < ā€“ highlight(g...

Table of contents

  1. Cover
  2. Half Title
  3. Series Page
  4. Title Page
  5. Copyright Page
  6. Dedication
  7. Table of Contents
  8. 1 Introduction
  9. I Creating views
  10. II Publishing views
  11. III Combining multiple views
  12. IV Linking multiple views
  13. V Event handling in JavaScript
  14. VI Various special topics
  15. Bibliography
  16. Index