Update app.R
Browse files
app.R
CHANGED
|
@@ -170,6 +170,9 @@ pitcher_arsenals_over_5perc <- download_private_csv("HyannisHarborHawksCCBL/Clea
|
|
| 170 |
logo_b64 <- base64enc::base64encode("HHLogo.png")
|
| 171 |
logo_uri <- paste0("data:image/png;base64,", logo_b64)
|
| 172 |
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
# =====================================================================
|
| 175 |
# Harbor Hawks — Pitcher Outing Report: component builders
|
|
@@ -467,8 +470,8 @@ theme_report <- function(base = 10) {
|
|
| 467 |
plot.title = element_text(hjust = .5, size = 20),
|
| 468 |
legend.title = element_blank(),
|
| 469 |
panel.grid.minor = element_blank(),
|
| 470 |
-
axis.title = element_text(size =
|
| 471 |
-
axis.text = element_text(size =
|
| 472 |
)
|
| 473 |
}
|
| 474 |
|
|
@@ -501,7 +504,7 @@ movement_plot <- function(outing, season_ref = NULL, pitch_col = "TaggedPitchTyp
|
|
| 501 |
geom_point(size = 2, alpha = 0.85) +
|
| 502 |
scale_color_manual(values = pitch_colors, name = NULL) +
|
| 503 |
coord_fixed(xlim = c(-28, 28), ylim = c(-28, 28)) +
|
| 504 |
-
labs(title = "Movement", x = "
|
| 505 |
theme_report() +
|
| 506 |
theme(
|
| 507 |
legend.position = "none"
|
|
@@ -1303,9 +1306,6 @@ ui <- fluidPage(
|
|
| 1303 |
"Raw data \u2014 run cleaning + tagging", value = FALSE),
|
| 1304 |
selectInput("pitcher", "Pitcher", choices = NULL, width = "100%"),
|
| 1305 |
selectInput("game", "Outing", choices = NULL, width = "100%"),
|
| 1306 |
-
selectInput("ref_source", "vs. Season reference",
|
| 1307 |
-
choices = c("From uploaded file" = "file", "None" = "none"),
|
| 1308 |
-
selected = "file", width = "100%"),
|
| 1309 |
actionButton("build", "Build report", class = "btn-scrape"),
|
| 1310 |
br(), br(),
|
| 1311 |
downloadButton("dl", "Download HTML", style = "width:100%;")
|
|
@@ -1601,17 +1601,10 @@ server <- function(input, output, session) {
|
|
| 1601 |
updateSelectInput(session, "game", choices = dts, selected = dts[1])
|
| 1602 |
})
|
| 1603 |
|
| 1604 |
-
season_data <- reactive({
|
| 1605 |
-
switch(input$ref_source %||% "none",
|
| 1606 |
-
"file" = processed_upload(),
|
| 1607 |
-
"none" = NULL)
|
| 1608 |
-
})
|
| 1609 |
-
|
| 1610 |
season_ref <- reactive({
|
| 1611 |
req(input$pitcher)
|
| 1612 |
-
|
| 1613 |
-
|
| 1614 |
-
build_season_ref(sd, input$pitcher, min_pitches = 1)
|
| 1615 |
})
|
| 1616 |
|
| 1617 |
outing <- reactive({
|
|
|
|
| 170 |
logo_b64 <- base64enc::base64encode("HHLogo.png")
|
| 171 |
logo_uri <- paste0("data:image/png;base64,", logo_b64)
|
| 172 |
|
| 173 |
+
#College 26 data
|
| 174 |
+
REFERENCE_DATA <- download_private_parquet("HyannisHarborHawksCCBL/PastSeasonData", "college_26_clean.parquet")
|
| 175 |
+
|
| 176 |
|
| 177 |
# =====================================================================
|
| 178 |
# Harbor Hawks — Pitcher Outing Report: component builders
|
|
|
|
| 470 |
plot.title = element_text(hjust = .5, size = 20),
|
| 471 |
legend.title = element_blank(),
|
| 472 |
panel.grid.minor = element_blank(),
|
| 473 |
+
axis.title = element_text(size = 13),
|
| 474 |
+
axis.text = element_text(size = 6)
|
| 475 |
)
|
| 476 |
}
|
| 477 |
|
|
|
|
| 504 |
geom_point(size = 2, alpha = 0.85) +
|
| 505 |
scale_color_manual(values = pitch_colors, name = NULL) +
|
| 506 |
coord_fixed(xlim = c(-28, 28), ylim = c(-28, 28)) +
|
| 507 |
+
labs(title = "Movement", x = "HB", y = "IVB") +
|
| 508 |
theme_report() +
|
| 509 |
theme(
|
| 510 |
legend.position = "none"
|
|
|
|
| 1306 |
"Raw data \u2014 run cleaning + tagging", value = FALSE),
|
| 1307 |
selectInput("pitcher", "Pitcher", choices = NULL, width = "100%"),
|
| 1308 |
selectInput("game", "Outing", choices = NULL, width = "100%"),
|
|
|
|
|
|
|
|
|
|
| 1309 |
actionButton("build", "Build report", class = "btn-scrape"),
|
| 1310 |
br(), br(),
|
| 1311 |
downloadButton("dl", "Download HTML", style = "width:100%;")
|
|
|
|
| 1601 |
updateSelectInput(session, "game", choices = dts, selected = dts[1])
|
| 1602 |
})
|
| 1603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1604 |
season_ref <- reactive({
|
| 1605 |
req(input$pitcher)
|
| 1606 |
+
if (is.null(REFERENCE_DATA) || !("Pitcher" %in% names(REFERENCE_DATA))) return(NULL)
|
| 1607 |
+
build_season_ref(REFERENCE_DATA, input$pitcher, min_pitches = 1)
|
|
|
|
| 1608 |
})
|
| 1609 |
|
| 1610 |
outing <- reactive({
|