0

I am creating a Shiny Leaflet app in R where am trying to display locations (markers) that correspond to a multiple dropdown filter. The data I have has many columns, but basically looks something like this:

ID  lat        lon         Service.A  Service.B  Service.C   etc.
1   37.92000   -122.17000  1          1          0           ...
2   37.90000   -121.48000  0          0          1           ...
3   37.78200   -121.33100  1          0          0           ...
... ...        ...         ...        ...        ...         ...

I would like to be able to select services A, B, C using the same multi-option filter such as selectizeInput() and server-side updateSelectizeInput() thus having only markers that correspond to the value of 1 for each column to be displayed on the map. In addition, I would like the filter to follow "and", rather than "or" logic, meaning that if I were to select Service.A and Service.C, the map would show only locations that provide both services A and C, but not A only, or C only.

How would I go about creating such a filter, where the binary values on which I want to filter are distributed across columns and the names of the filter options are in column headers, as shown above?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.