
I am using this mock data. Please download and have a look. We have 3 filters here: Continent, Country, and State. If I select Asia only Asian countries should come in the second filter and if I select India as country only Indian states should appear on the third filter.
If you want a shortcut you can directly use shinyFilters. Detail documentation is provided here.
But here you don’t have control to present the data. You get the filtered data in few clicks but which columns you want to show or if you want to process the data further you have very fewer options. So I have written my own code to make cascading filters after spending few hours playing around shinyFilters and DT packages.

- Import the data
- Show ‘Continent’ from the data
- Subset the data further for selected ‘Continent’
- Show ‘Country’ from the subset data
- Subset the subset data for selected ‘Country’
- Show ‘State’ from the subset data
- Subset the above data for selected ‘State’
ui.r
######################################################################## setwd("......\\R Codes") header <- dashboardHeader( title = "TopBullets.com Dashboard", dropdownMenu(type = "notifications", notificationItem( text = "Designed by Deepesh Singh", icon("cog", lib = "glyphicon") ) ) ...........
server.r
options(shiny.maxRequestSize = 15*1024^2) shinyServer(function(input,output){ # Importing data and save it temporarily in data variable data <- reactive({ read.table(file = "......\\Countries-Continents-csv.csv", sep = ",", header = T, stringsAsFactors = F) }) output$state <- renderUI({ selectInput(inputId = "State", "Select State",choices = var_state(),selected = "Goa") }) .......... ############################ CODE ENDS HERE ###########################################
You can download the codes here. Download
Hello Deepesh,
This is fantastic work. I would like to use this for one part of my work. can I get the link for the codes?
Please share your email id or download again from here
https://www.dropbox.com/s/5ii7fkt4anedjpb/R%20Codes.zip?dl=0
Hi Deepesh. Many thanks for sharing this example – it has helped me better understand as I get through the Shiny learning curve! Also, thank you for referencing shinyFilters, which unfortunately I could not install because of an error related to a file called Rprofile? All the best.
Thank you David for your kind words. Good luck with your project.