1. Learn
  2. /
  3. Courses
  4. /
  5. Case Studies: Building Web Applications with Shiny in R

Connected

Exercise

Create a new word cloud on demand

After isolating the word cloud render code so that it wouldn't update too often, the last step is to provide a way to render the word cloud only when the user chooses to. This can be achieved with the help of an actionButton().

Instructions

100 XP

Your task is to add a button to the Shiny app, and re-render the word cloud when the button gets pressed. Specifically:

  • Add an action button to the app with an input ID of "draw" and a label of "Draw!" (line 26).
  • Add the button as a dependency in the word cloud rendering function so that the word cloud will re-run when the button is pressed (line 56).