mykoz 2015-11-07 16:46:16 -05:00
commit 1cc6af83c0
2 changed files with 33 additions and 11 deletions

View File

@ -3,26 +3,46 @@ library(ggplot2)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
#datasets <- list.files('./data/')
emergency2013 <- read.csv("./data/emergency2013.csv")
output$fileSelect <- renderUI({
selectInput("dataSetInput", "Choose your survey:", list.files('./data/'))
})
#currentDataset <- read.csv(paste0('./data/', input$dataSetInput))
output$columnList <- renderUI({
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
checkboxGroupInput('show_vars', 'Columns in dataset to show:', names(currentDataset), selected = NULL)
})
output$distPlot <- renderPlot({
plot(emergency2013$duid, emergency2013$vstctgry)
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
plot(currentDataset$duid, currentDataset$vstctgry)
})
output$mytable1 <- renderDataTable({
emergency2013[, input$show_vars, drop = FALSE]
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
currentDataset[, input$show_vars, drop = FALSE]
})
output$mytable2 <- renderDataTable({
summary(emergency2013[, input$show_vars, drop = FALSE])
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
summary(currentDataset[, input$show_vars, drop = FALSE])
})
output$myplot <- renderPlot({
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
library(ggplot2)
library(corrplot)
pairs(emergency2013[, input$show_vars, drop = FALSE])
pairs(currentDataset[, input$show_vars, drop = FALSE])
emergency2013[, input$show_vars, drop = FALSE]
currentDataset[, input$show_vars, drop = FALSE]
})
})

View File

@ -5,19 +5,21 @@ shinyUI(fluidPage(
# Application title
titlePanel("Hello Shiny!"),
# Sidebar with a slider input for the number of bins
sidebarLayout(
sidebarPanel(
checkboxGroupInput('show_vars', 'Columns in dataset to show:', names(emergency2013), selected = NULL)),
uiOutput('fileSelect'),
uiOutput('columnList')
),
# Show a summary table of the selected variables
mainPanel(
tabsetPanel(
id = 'dataset',
tabPanel('emergency2013', dataTableOutput('mytable1')),
tabPanel('emergency2013', dataTableOutput('mytable2')),
tabPanel('emergency2013', plotOutput('myplot')))
tabPanel('Data Table', dataTableOutput('mytable1')),
tabPanel('Summary Statistics', dataTableOutput('mytable2')),
tabPanel('Scatter Plots', plotOutput('myplot')))
)
)
)
)
)