From the course: Building Data Apps with R and Shiny: Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Populate pull-down menus from data

Populate pull-down menus from data

From the course: Building Data Apps with R and Shiny: Essential Training

Start my 1-month free trial

Populate pull-down menus from data

- [Instructor] Let's take a look at how we can use updateSelectInput() to populate pulldown menus with data. To do this, we're going to go to our exercise files and we'll open 06_01 and open our Rstudio project. Let's open up our ui.r file and our server.r file and let's run the app to see what we have. So the first tab is called without updateSelectInput() and we have a pulldown menu here, which allows us to select a country. Let's choose Switzerland, and we're shown below the percentage of the population using the internet in that country. So that's a wonderful looking chart. Let's have a look at how this is generated in our ui.r file. So, I'll close my shiny app. We'll go to our ui.r file, and it's actually quite hard to navigate a ui.r file because in select input, we've had to list all of the countries that are available to us. This makes the ui.r file difficult to read, but it also means that if that dataset were to include data from new countries, we'd have to come and hard…

Contents