Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Web Application Development with R Using Shiny

You're reading from   Web Application Development with R Using Shiny Build stunning graphics and interactive data visualizations to deliver cutting-edge analytics

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher
ISBN-13 9781788993128
Length 238 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Chris Beeley Chris Beeley
Author Profile Icon Chris Beeley
Chris Beeley
Shitalkumar R. Sukhdeve Shitalkumar R. Sukhdeve
Author Profile Icon Shitalkumar R. Sukhdeve
Shitalkumar R. Sukhdeve
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Beginning R and Shiny 2. Shiny First Steps FREE CHAPTER 3. Integrating Shiny with HTML 4. Mastering Shiny's UI Functions 5. Easy JavaScript and Custom JavaScript Functions 6. Dashboards 7. Power Shiny 8. Code Patterns in Shiny Applications 9. Persistent Storage and Sharing Shiny Applications 10. Other Books You May Enjoy

Event-handling using observeEvent and eventReactive

So far, we have looked at how reactivity works in Shiny applications. We have learned how to use observe() and isolate(). We will now look in more detail at event-handling. An event can be defined as a reactive value or an expression that triggers other calculations. For example, sometimes we want some actions to happen only after the action button is clicked.

We have already learned to handle events using observe() and isolate(). There are two more methods:

  • observeEvent
  • eventReactive

These two provide straightforward ways of handling events:

  • observeEvent: If we want to perform an action in response to an event, observeEvent is useful. The syntax is as follows:
    observeEvent(eventExpr, handlerExpr, event.env = parent.frame(), 
    event.quoted = FALSE, handler.env = parent.frame(), 
    handler.quoted = FALSE, label =...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime