R shiny_selectInput for Manufacturer in mpg dataset

Hello guys,

I would like to create a dropdown from manufacturer column from 'mpg' data using r shiny selectInput function.

so, I should get options like: audi, chevrolet, dodge, ford, etc. in the dropdown.

How should I go about it? Once I select the manufacturer (lets say 'Audi'), I want to plot a graph on disp vs cyl for Audi.

Thanks in advance.

Here is a link to the documentation and examples
https://shiny.rstudio.com/reference/shiny/latest/selectInput.html

I have been through that. Not sure how can I filter values of one column and use it in select dropdown. Any lead will be helpful.

Many thanks :slight_smile:

what have you tried ? please share your code so it can be improved upon..

Are you familiar with dplyr / tidyverse ?
It provides an elegant way to approach data filtering and selection from dataframes(tabular structures).
You can learn a lot very fast from

If you want your input to read from the database and present valid choices to the user then the key way to do that is to include a updateSelectInput function in your server to change the choices argument (https://shiny.rstudio.com/reference/shiny/0.14/updateSelectInput.html). It needs a selectInput set in the ui and matches it by id.

Give it a go and see if it solves your problem!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.