Book Image

Web Application Development with R Using Shiny - Third Edition

By : Chris Beeley, Shitalkumar R. Sukhdeve
Book Image

Web Application Development with R Using Shiny - Third Edition

By: Chris Beeley, Shitalkumar R. Sukhdeve

Overview of this book

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.
Table of Contents (11 chapters)

What this book covers

Chapter 1, Beginning R and Shiny, runs through the basics of statistical graphics, data input, and analysis with R. We also discuss data structures and programming basics in R in order to give you a thorough grounding in R before we look at Shiny.

Chapter 2, Shiny First Steps, helps you build your first Shiny application. We begin by simply adding interactive content to a document written in Markdown; and then delve deeper into Shiny, building a very primitive and minimal example; and finally, we'll look at more complex applications and the inputs and outputs necessary to build them.

Chapter 3, Integrating Shiny with HTML, covers how Shiny works with existing web content in HTML and CSS. We discuss the Shiny helper functions that allow you to add a custom HTML to a standard Shiny application and how to build a minimal example of a Shiny application in your own raw HTML with Shiny running in the background. We'll also get into the use of HTML templates, which make integrating Shiny with HTML easy.

Chapter 4, Mastering Shiny's UI Functions, describes all the different ways that Shiny offers to help you achieve the layout and appearance that you want your application to have. It discusses how to show and hide elements of the interface, as well as how to make the interface react to the state of the application. Producing attractive data tables is discussed, as well as how to give your users messages with progress bars and modals.

Chapter 5, Easy JavaScript and Custom JavaScript Functions, covers using JavaScript with Shiny, right from adding simple JavaScript right on the page to enhance a program's appearance or functionality, to sending messages to and from the client's browser using messages to and from JavaScript. The use of the shinyjs and htmlwidgets packages is also discussed, which further add to your ability to add custom or canned JavaScript to a Shiny application.

Chapter 6, Dashboards, includes a couple of different types of Shiny dashboard, and describes how to make attractive Shiny dashboards, using color, icons, and a wide range of inputs and outputs, as well as how to lay them out using the very flexible layout functions, which can be accessed with a Shiny dashboard.

Chapter 7, Power Shiny, includes many powerful features of Shiny, such as animating plots, reading client information, and GET requests in Shiny. We will go through graphics and report generation and how to download them using knitr. Downloading and uploading is also an interesting part of any application, and we'll take a look at it in Shiny with some examples. Bookmarking the state of the application is an add-on to regenerate the output on the application. We will see a demonstration of fast application development using widgets and gadgets. At the end of the chapter, we will see how to authenticate the application using a password.

Chapter 8, Code Patterns in Shiny Applications, covers the coding patterns available in Shiny. We will discuss reactivity in R Shiny, controlling specific input with the isolate() function, running reactive functions over time, event handling using the observeEvent functions and the Shinytest modules, debugging, handling errors (including validate() and req()), profiling R code, debounce, and throttle.

Chapter 9, Persistent Storage and Sharing Shiny Applications, will explore how to keep your code on GitHub. This chapter will include an introduction to GitHub and how to integrate Git with RStudio. We will also learn how to share your reports and a live application with Shinyapps.io. This chapter will also focus on the deployment options available, such as Shiny Server and running Shiny in AWS. We will go through some of the concepts that are vital for developing a good Shiny application, such as scoping, loading, and reusing data in Shiny applications. We'll also look at temporary data input/output, permanent data functions, databases, SQL injection, and databases with the pool package.