Interactive Data Analysis with R Shiny: Reactivity

In this session, second in the series Interactive Data Analysis with R Shiny, we will divide and conquer the mystery of interactivity in Shiny apps by creating a “Coffee Recommend-er” app that uses each of the many reactivity functionalities available.

Reactive functions enable the various flavors of reactivity in Shiny. We will master the following functions:

  • Reactive expressions
  • Isolate
  • Event Reactive expressions
  • Observe Event expressions

Unavailable
Interactive Data Analysis with R Shiny: Reactivity

Task List


We will cover the following tasks in 1 hour and 1 minute:


Introduction

Welcome to this session!


The Coffee Recommender App

In this chapter, we will gather context for all upcoming chapters by understanding the inner working of our desired application.

Based on the choices entered by the user like the size and milk used, the application renders a list of recommended beverages along with a graph for nutritional values.


The plot

In this chapter, we will design a plot that will act as an output for the selections the users will make using our input widgets. By changing the various reactive functions we use in the server object, we will observe changes in rendering of the output.


Reactive Expressions

In this chapter, we will understand the Reactive Expressions in great detail. Reactive expressions lets us control which parts of our app update when, which prevents unnecessary computation that can slow down our application.


The Table

In this chapter, we will use the reactive expressions from the previous chapter to render an interactive table in the application. The table acts as the output, in conjunction with the plot. We will observe how changes in the input and various reactive functions influence the output.


Isolate function

Sometimes it’s useful for an observer/endpoint to access a reactive value or expression, but not to take a dependency on it. For example, if the observer performs a long calculation or downloads large data set, we might want it to execute only when a button is clicked. In this chapter, we will understand and apply Isolate expressions which cater to these use cases.


Event Reactive expressions

In this chapter, we will apply the Event Reactive expressions in our application and explore the difference between Reactive expressions and the Event Reactive expressions. eventReactive is used to create a calculated value that only updates in response to an event. This is just like a normal reactive expression except it ignores all the usual invalidations that come from its reactive dependencies


Observe Event expressions

In this chapter, we will apply the Observe Event expressions in our app and differentiate it with expressions we saw previously. observeEvent is used whenever we want to perform “an action” in response to an event.


Recap

In this chapter, we will review all the reactivity concepts applied in this session. While the purpose of each type of expression covered is to provide interactivity in different ways with different conditions, understanding the subtleties between their functioning can greatly enhance our ability to use Shiny’s reactivity model to our advantage.

Watch Preview

Preview the instructions that you will follow along in a hands-on session in your browser.

Kena Shah

About the Host


Kena Shah



Frequently Asked Questions


In Rhyme, all projects are completely hands-on. You don't just passively watch someone else. You use the software directly while following the host's (Kena Shah) instructions. Using the software is the only way to achieve mastery. With the "Live Guide" option, you can ask for help and get immediate response.
Nothing! Just join through your web browser. Your host (Kena Shah) has already installed all required software and configured all data.
You can go to https://rhyme.com/for-companies, sign up for free, and follow this visual guide How to use Rhyme to create your own sessions. If you have custom needs or company-specific environment, please email us at help@rhyme.com
Absolutely. We offer Rhyme for workgroups as well larger departments and companies. Universities, academies, and bootcamps can also buy Rhyme for their settings. You can select sessions and trainings that are mission critical for you and, as well, author your own that reflect your own needs and tech environments. Please email us at help@rhyme.com
Please email us at help@rhyme.com and we'll respond to you within one business day.

No sessions available