Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Handling multiple drop down in bar plot

Hi ,

I am new to R. I am trying to create a simple shiny
application which will display barplot using left drop down input. It
works for me when i have to plot for one drop down. however, it does not
work for multiple drop down.

I have three columns in my dataframe

  1. Region
  2. Country -
  3. Rating

My
requirement is when I select “Region” it should plot region (EMEA,
Asia, Americas) specific rating. and when I select Country (I.e.India,
Maxico, China, Spain etc ) it should show country specific rating. All
in bar graph.

Yes, The drop down should be dependent to each other. Please suggest me with some examples.

Thanks in advance.

Rahul

Hey there’s a collection of shiny examples here: https://plot.ly/r/shiny-gallery. Maybe you can find what’re you looking for in there.

It sounds like you didn’t wrap the plot in a reactive expression thus when you change the input in the drop down the plot is not being rendered with the new data.

Here is a good example of using a drop down to change the data used for a plot:
https://plot.ly/r/shinyapp-explore-diamonds/

Here is the tutorial for reactive expressions. If you take the time to go through this slowly and understand it then your simple app should be very easy to do:
http://shiny.rstudio.com/tutorial/lesson6/

1 Like