Changing a Shiny app UI based on user input

Employing tools acquired in the previous recipe, you will be able to go quite far exploring Shiny's possibilities.

However, there is a quite advanced topic that was excluded from the previous recipe: UI customization based on user input.

This is an amazing feature, and it is even more amazing if you think you don't have to learn JavaScript or any other language to apply it to your app. Only R code knowledge is needed. Our app will ask for a first question and consequently change the possible answers to a second question.

One last word; our app will be based on the Lord of the Rings characters. I hope you will appreciate this. Now, let's start without any ado; as Samwise Gamgee would say:

"It's the job that's ...

Get RStudio for R Statistical Computing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.