Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(dplyr)
- library(ggplot2)
- all <- read.csv("/home/trentdennis/ALLMLBgameswopp.csv", stringsAsFactors = FALSE)
- function(input,output) {
- output$teamOutput <- renderUI({
- selectInput("teamInput", "Team",
- sort(unique(all$Abbreviation2)),
- selected = "ARI")
- })
- filtered <- reactive({
- if(is.null(input$teamInput)) {
- return(NULL)
- }
- all %>%
- filter(ML >= input$percentInput[1],
- ML <= input$percentInput[2],
- SP >= input$percenttInput[1],
- SP <= input$percenttInput[2],
- SPResult == input$statusInput,
- Location == input$locInput,
- Abbreviation2 == input$teamInput
- )
- })
- output$ggplot <- renderPlot({
- if(is.null(filtered())) {
- return()
- }
- ggplot(filtered()) +
- geom_point(aes(x = ML, y = Result, color = Location, alpha = .4)) +
- theme_classic()
- })
- output$ggplot2 <- renderPlot({
- if(is.null(filtered())) {
- return()
- }
- ggplot(filtered()) +
- geom_histogram(aes(x = Result)) +
- theme_classic()
- })
- output$results <- renderTable({
- filtered()
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement