diff --git a/shiny-app/server.R b/shiny-app/server.R index 67a2319..effd3f9 100644 --- a/shiny-app/server.R +++ b/shiny-app/server.R @@ -1,13 +1,18 @@ library(shiny) +library(ggplot2) # Define server logic required to draw a histogram shinyServer(function(input, output) { emergency2013 <- read.csv("./data/emergency2013.csv") + output$distPlot <-renderPlot({ + plot(emergency2013$duid, emergency2013$vstctgry) + }) + output$mytable1 <- renderDataTable({ - library(ggplot2) + emergency2013[, input$show_vars, drop = FALSE] - + }) }) \ No newline at end of file diff --git a/shiny-app/ui.R b/shiny-app/ui.R index b9562a3..998d4fa 100644 --- a/shiny-app/ui.R +++ b/shiny-app/ui.R @@ -10,14 +10,18 @@ shinyUI(fluidPage( sidebarLayout( sidebarPanel( checkboxGroupInput('show_vars', 'Columns in dataset to show:', - names(emergency2013), selected = names(emergency2013)) + names(emergency2013), selected = null) ), # Show a summary table of the selected variables + + mainPanel( tabsetPanel( id = 'dataset', - tabPanel('emergency2013', dataTableOutput('mytable1'))) + tabPanel('emergency2013', dataTableOutput('mytable1')), + tabPanel('scatterplot', plotOutput('distPlot')) + ) ) ) )) \ No newline at end of file