library("ggplot2")
library("dplyr")
data(iris)
selectInput("flower_choice", "Choose your flower", 
            choices = unique(iris$Species))
selected = reactive({
  filter(iris, Species == input$flower_choice)
})
renderText({
  mean(selected()$Petal.Width)
})
renderPlot({
  ggplot(selected(), aes(x = Petal.Width, 
                       y = Petal.Length)) +
    geom_point()
  # or
  # plot(selected$Petal.Width, selected$Petal.Length)
})


jr-packages/jrShiny documentation built on Feb. 16, 2020, 9:13 p.m.