O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Web Application Development with R Using Shiny - Third Edition

Book Description

Analyze, communicate, and design your own sophisticated and interactive web applications using the R (v 3.4) Shiny (1.1.0) package

Key Features

  • Explore the power of R Shiny to make interactive web applications easily
  • Create engaging user interfaces using elements such as HTML5 shiny tags and Ttabsets
  • Build and deploy your interactive Shiny web application using shinyapps.io

Book Description

Web Application Development with R Using Shiny helps you become familiar with the complete R Shiny package. The book starts with a quick overview of R and its fundamentals, followed by an exploration of the fundamentals of Shiny and some of the things that it can help you do. You'll learn about the wide range of widgets and functions within Shiny and how they fit together to make an attractive and easy to use application.

Once you have understood the basics, you'll move on to studying more advanced UI features, including how to style apps in detail using the Bootstrap framework or and Shiny's inbuilt layout functions.

You'll learn about enhancing Shiny with JavaScript, ranging from adding simple interactivity with JavaScript right through to using JavaScript to enhance the reactivity between your app and the UI.

You'll learn more advanced Shiny features of Shiny, such as uploading and downloading data and reports, as well as how to interact with tables and link reactive outputs. Lastly, you'll learn how to deploy Shiny applications over the internet, as well as and how to handle storage and data persistence within Shiny applications, including the use of relational databases.

By the end of this book, you'll be ready to create responsive, interactive web applications using the complete R (v 3.4) Shiny (1.1.0) suite.

What you will learn

  • Harness the power of JavaScript to customize your applications
  • Build dashboards with predefined UI and layouts
  • Engage your users and build better analytics using interactive plots
  • Learn advanced code patterns to make your applications easy to write and maintain.
  • Develop a full understanding of Shiny's UI functions to give you the power to build a wide variety of attractive applications.
  • Store data and interact with databases with Shiny.
  • Learn how to share your Shiny applications
  • Understand reactivity at the conceptual level to build more efficient and robust apps

Who this book is for

Web Application Development with R Using Shiny is for you if you are interested in creating compelling web applications and interactive data visualization over the web using Shiny. Programming experience with R is required.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Web Application Development with R Using Shiny Third Edition
  3. www.PacktPub.com
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Beginning R and Shiny
    1. Installing R
    2. The R console
    3. Code editors and IDEs
    4. Learning R
      1. Getting help
    5. Loading data
    6. Data types and structures
      1. Dataframes, lists, arrays, and matrices
      2. Variable types
      3. Functions
      4. Objects
    7. Base graphics and ggplot2
      1. Bar chart
      2. Line chart
    8. Introduction to the tidyverse
      1. Ceci n'est pas une pipe
      2. Gapminder
      3. A simple Shiny-enabled line plot
    9. Installing Shiny and running the examples
    10. Summary
  7. Shiny First Steps
    1. Types of Shiny application
      1. Interactive Shiny documents in RMarkdown
    2. A minimal example of a full Shiny application
      1. The ui.R of the minimal example
        1. A note on HTML helper functions
        2. The finished interface
      2. The server.R of the minimal example
        1. The program structure
        2. An optional exercise
          1. Embedding applications in documents
    3. Widget types
    4. The Gapminder application
      1. The UI
      2. Data processing
      3. Reactive objects
      4. Outputs
        1. Text summary
        2. Trend graphs
        3. A map using leaflet
    5. Advanced layout features
    6. Summary
  8. Integrating Shiny with HTML
    1. Running the applications and code
    2. Shiny and HTML
    3. Custom HTML links in Shiny
      1. ui.R
      2. server.R
    4. A minimal HTML interface
      1. index.html
      2. server.R
    5. Including a Shiny app on a web page
    6. HTML templates
      1. Inline template code
        1. server.R
        2. ui.R and template.html
      2. Defining code in the ui.R file
        1. ui.R
      3. Take a step back and rewind
    7. Exercise
      1. Debugging
    8. Bootstrap 3 and Shiny
    9. Summary
  9. Mastering Shiny's UI Functions
    1. Shiny's layout functions
      1. Simple
      2. Complete
      3. Do it yourself
      4. Combining layout functions
    2. Streamlining the UI by hiding elements
      1. Naming tabPanel elements
    3. Beautiful tables with DataTable
    4. Reactive user interfaces
      1. The reactive user interface example – server.R
      2. The reactive user interface example – ui.R
    5. Progress bars
    6. Progress bar with shinycssloaders
    7. Modals
    8. Alternative Shiny designs
    9. Summary
  10. Easy JavaScript and Custom JavaScript Functions
    1. JavaScript and Shiny
      1. Example 1 – reading and writing the DOM
        1. ui.R
        2. appendText.js
      2. Example 2 – sending messages between client and server
        1. ui.R
        2. server.R
        3. dropdownDepend.js
    2. Shinyjs
    3. Extendshinyjs
      1. ui.R
      2. server.R
      3. JavaScript
    4. Responding to events in JavaScript
    5. htmlwidgets
      1. Dygraphs
    6. rCharts
    7. d3heatmap
    8. threejs
    9. Summary
  11. Dashboards
    1. Applications in this chapter
    2. Flexdashboards
    3. Sidebar application with extra styling
      1. Adding icons to your UI
      2. Using shinythemes
    4. Using the grid layout
      1. ui.R
    5. Full dashboard
      1. Notifications
    6. Info boxes
      1. ui.R
      2. Google Charts gauge
        1. Resizing the Google chart
      3. ui.R
    7. Summary
  12. Power Shiny
    1. Animation
    2. Reading client information and GET requests in Shiny
    3. Custom interfaces from GET strings
    4. Downloading graphics and reports
    5. Downloadable reports with knitr
    6. Downloading and uploading data
    7. Bookmarking
      1. Bookmarking state
        1. Encoding the state into a URL
          1. Single-file application
          2. Multiple-file application
        2. Bookmarking by saving the state to the server
    8. Interactive plots
    9. Interactive tables
      1. Row selection
      2. Column selection
      3. Cell Selection
    10. Linking interactive widgets
    11. Shiny gadgets
    12. Adding a password
    13. Summary
  13. Code Patterns in Shiny Applications
    1. Reactivity in RShiny
      1. A closer look at reactivity
    2. Controlling specific input with the isolate() function
    3. Running reactive functions over time (execution scheduling)
    4. Event-handling using observeEvent and eventReactive
    5. Functions and modules
    6. Shinytest
    7. Debugging
    8. Handling errors (including validate() and req())
      1. Validate
      2. Handling missing input with req()
    9. Profiling R code
    10. Debounce and throttle
    11. Summary
  14. Persistent Storage and Sharing Shiny Applications
    1. Sharing over GitHub
      1. An introduction to Git
      2. Using Git and GitHub within Rstudio
        1. Projects in RStudio (h3)
    2. Sharing applications using Git
      1. Sharing using .zip and .tar
        1. Sharing with the world
      2. Shinyapps.io
        1. Shinyapps.io without RStudio
        2. Shiny server
        3. Running Shiny app on Amazon AWS
      3. Scoping, loading, and reusing data in Shiny applications
        1. Temporary data input/output
    3. Persistent data storage
    4. Database using Dplyr, DBI, and POOL
    5. SQL Injection
    6. Summary
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think