Black Lives Matter. Please consider donating to Black Girls Code today.

Problem using dropdown menu in R


I was delighted to see that it seems to be possible to include dropdown menu in R plotly as described here :

However, I can’t make this code work : I get no error, but no map either in the visualisation tab of Rstudio. When I try to export it using render, if I open the html I get the map, but no dropdown menu. I run plotly 3.6.0 on Rstudio 0.99.903, with R 3.3.1.

wow no answer at all ? Is there a problem with my question ? Or is this forum not to be used for this ? This is quite confusing.

Hi there, the example you were looking at applies some javascript code (the full code is viewable in the codepen embedded in that documentation page:

However, we did recently add dropdown menus to Plotly so you’re able to add dropdowns simply in R (without having to implement js as in that example!)

This feature is currently in our dev package, not our latest CRAN package (this is what you are using), but we will be updating our CRAN package in the near future!

In the meantime, you can follow this blog post: and use our latest dev version of Plotly for R: