library("dplyr") library("plotly") library("DT") data(iris) actionButton("setosa","Setosa!") actionButton("versicolor", "Versicolor!") rvs = reactiveValues(data = iris)
observeEvent(input$setosa, { rvs$data = filter(iris, Species == "setosa") }) observeEvent(input$versicolor, { rvs$data = filter(iris, Species == "versicolor") })
renderPlot({ ggplot2(rvs$data, aes(x = Petal.Width, y = Petal.Length)) + geom_point() }) renderPlotly({ g = ggplot2(rvs$data, aes(x = Petal.Width, y = Petal.Length)) + geom_point() ggplotly(g) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.