The reactive user interface example – ui.R

The ui.R file merely needs to point to the reactive definition, as shown in the following line of code (just add it to the list of widgets within sidebarPanel()):

uiOutput("yearSelectorUI") 

You can now point to the value of the widget in the usual way, as input$yearSelector.

There are more advanced things you can do with a reactive UI using the insertUI() and removeUI() functions, which allow you to insert arbitrary controls or sets of controls and remove controls, respectively. Although they are quite simple to actually produce, making use of them is quite tricky because of the need to keep track of the names given to each input, as well as which have been added and removed so far. As a consequence, ...

Get Web Application Development with R Using Shiny - Third Edition 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.