Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(shinydashboard)
- library(ggplot2)
- library(rsconnect)
- shinyServer(function(input, output){
- datasetInput <- reactive({
- switch(input$year,
- "2017" = m17,
- "2018" = m18)
- }
- )
- stInput <- reactive({
- dset <- datasetInput()
- switch(input$st,
- "Elementary" = dset[which(dset$schtype == "ES"),],
- "Middle" = dset[which(dset$schtype == "MS"),],
- "High" = dset[which(dset$schtype == "HS"),])
- })
- output$data <- renderTable({
- cc <- as.numeric(input$var)
- ccc <- as.numeric(input$gen)
- st <- stInput()
- st[1:20,c(cc,ccc)]
- })
- output$summary <- renderTable({
- st <- datasetInput()
- summary(st)
- })
- output$mybar<- renderPlot({
- coco <- as.numeric(input$var)
- coc <- as.numeric(input$gen)
- st <- stInput()
- ggplot(st, aes(y=st[,coco], x = st[,coc], fill = highneeds)) +
- stat_summary(fun.y = mean, geom = "bar", position = "dodge")+
- labs(y = "score", x = names(st[coc]))
- })
- output$mybar1<- renderPlot({
- coco <- as.numeric(input$var)
- st <- stInput()
- ggplot(st, aes(x=st[,coco])) +
- geom_histogram(color="black", fill="lightblue", linetype = "dashed")+
- labs(x = "score")
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement