betterwithdata_cleaning_4/shiny-app/server.R

48 lines
1.4 KiB
R
Raw Normal View History

2015-11-07 11:50:03 -05:00
library(shiny)
library(ggplot2)
2015-11-07 11:50:03 -05:00
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
2015-11-07 16:36:45 -05:00
#datasets <- list.files('./data/')
2015-11-07 12:04:32 -05:00
emergency2013 <- read.csv("./data/emergency2013.csv")
2015-11-07 11:50:03 -05:00
2015-11-07 16:36:45 -05:00
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({
2015-11-07 16:36:45 -05:00
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
plot(currentDataset$duid, currentDataset$vstctgry)
})
2015-11-07 12:37:27 -05:00
output$mytable1 <- renderDataTable({
2015-11-07 16:36:45 -05:00
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
currentDataset[, input$show_vars, drop = FALSE]
2015-11-07 13:50:31 -05:00
})
output$mytable2 <- renderDataTable({
2015-11-07 16:36:45 -05:00
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
summary(currentDataset[, input$show_vars, drop = FALSE])
})
2015-11-07 13:50:31 -05:00
output$myplot <- renderPlot({
2015-11-07 16:36:45 -05:00
currentDataset <- read.csv(paste0('./data/', input$dataSetInput, sep=''))
2015-11-07 12:37:27 -05:00
library(ggplot2)
2015-11-07 13:48:22 -05:00
library(corrplot)
2015-11-07 16:36:45 -05:00
pairs(currentDataset[, input$show_vars, drop = FALSE])
2015-11-07 13:46:54 -05:00
2015-11-07 16:36:45 -05:00
currentDataset[, input$show_vars, drop = FALSE]
2015-11-07 13:46:54 -05:00
2015-11-07 11:50:03 -05:00
})
})