library(shiny)
library(rvest)
library(xml2)
library(tidyverse)
library(dplyr)
ui <- fluidPage(
titlePanel("MLB Batting Statistics"),
sidebarLayout(
sidebarPanel(
numericInput( "Year", label = "Year", value = 2021, min = 1900, max = 2021),
textInput("Team", label = "Team Abbreviation", value = "ATL"),
selectInput("Statistic", label = "Statistic", choices = c("Plate Appearances" = "PA", "On Base Percentage" = "OBP", "Home Runs" = "HR", "Runs Batted In" = "RBI", "Runs Scored/Allowed" = "R", "Hits/ Hits Allowed" = "H", "At Bats" = "AB", "Stolen Bases" = "SB", "Strikeouts" = "SO", "Batting Average" = "BA"), selected = "PA")
),
mainPanel(
plotOutput("Histogram")
),
)
)
server <- function(input, output) {
output$Histogram <- renderPlot({
MLB_Team_Graphic(input$Team, input$Year, input$Statistic)
})
}
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.