#
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
#    https://shiny.posit.co/
#

library(shiny)
library(ggplot2)
library(dplyr)

# Define server logic required to draw a histogram
function(input, output, session) {

  dat <- read.csv("penguins.csv")
  
  output$mygraph <- renderPlot({
  if(input$checkbox){dat %>% 
      filter(island == input$island) %>% 
    ggplot(aes(x = bill_length_mm)) + 
    geom_histogram()}
  })
  
}
