Update app.R
Browse files
app.R
CHANGED
|
@@ -519,7 +519,7 @@ summary_table <- function(game) {
|
|
| 519 |
'VAA' = round(mean(VAA, na.rm = TRUE), 1),
|
| 520 |
'CSW%' = round(sum(team_fielding_id, na.rm = TRUE) / sum(!is.na(team_fielding_id)) * 100, 1),
|
| 521 |
'Whiff%' = round(sum(is_strike_swinging, na.rm = TRUE) / sum(swing, na.rm = TRUE) * 100, 1),
|
| 522 |
-
'
|
| 523 |
) %>%
|
| 524 |
arrange(-Pitches)
|
| 525 |
|
|
@@ -547,7 +547,7 @@ summary_table <- function(game) {
|
|
| 547 |
'VAA' = round(mean(VAA, na.rm = TRUE), 1),
|
| 548 |
'CSW%' = round(sum(team_fielding_id, na.rm = TRUE) / sum(!is.na(team_fielding_id)) * 100, 1),
|
| 549 |
'Whiff%' = round(sum(is_strike_swinging, na.rm = TRUE) / sum(swing, na.rm = TRUE) * 100, 1),
|
| 550 |
-
'
|
| 551 |
)
|
| 552 |
|
| 553 |
# Combine main summary with total row
|
|
@@ -618,7 +618,7 @@ server <- function(input, output, session) {
|
|
| 618 |
)
|
| 619 |
} else {
|
| 620 |
fluidPage(
|
| 621 |
-
titlePanel("Trackman Summary Card
|
| 622 |
sidebarLayout(
|
| 623 |
sidebarPanel(
|
| 624 |
width = 3,
|
|
@@ -834,8 +834,8 @@ server <- function(input, output, session) {
|
|
| 834 |
geom_point(size = 1, na.rm = TRUE) +
|
| 835 |
scale_color_manual(values = pitch_colors) +
|
| 836 |
theme_minimal() +
|
| 837 |
-
labs(title = paste0(input$rollnum,"-Pitch Rolling
|
| 838 |
-
x = "Pitch Number", y = "
|
| 839 |
scale_y_continuous(limits = c(70, 130), na.value = NA) +
|
| 840 |
scale_x_continuous(breaks = seq(input$rollnum, max(rolling_data$pitch_number, na.rm = TRUE), by = input$rollnum), limits = c(input$rollnum, NA)) +
|
| 841 |
theme(
|
|
|
|
| 519 |
'VAA' = round(mean(VAA, na.rm = TRUE), 1),
|
| 520 |
'CSW%' = round(sum(team_fielding_id, na.rm = TRUE) / sum(!is.na(team_fielding_id)) * 100, 1),
|
| 521 |
'Whiff%' = round(sum(is_strike_swinging, na.rm = TRUE) / sum(swing, na.rm = TRUE) * 100, 1),
|
| 522 |
+
'TimStuff+' = if("TimStuff" %in% colnames(game)) round(mean(TimStuff, na.rm = TRUE), 0) else NA
|
| 523 |
) %>%
|
| 524 |
arrange(-Pitches)
|
| 525 |
|
|
|
|
| 547 |
'VAA' = round(mean(VAA, na.rm = TRUE), 1),
|
| 548 |
'CSW%' = round(sum(team_fielding_id, na.rm = TRUE) / sum(!is.na(team_fielding_id)) * 100, 1),
|
| 549 |
'Whiff%' = round(sum(is_strike_swinging, na.rm = TRUE) / sum(swing, na.rm = TRUE) * 100, 1),
|
| 550 |
+
'TimStuff+' = if("TimStuff" %in% colnames(game)) round(mean(TimStuff, na.rm = TRUE), 0) else NA
|
| 551 |
)
|
| 552 |
|
| 553 |
# Combine main summary with total row
|
|
|
|
| 618 |
)
|
| 619 |
} else {
|
| 620 |
fluidPage(
|
| 621 |
+
titlePanel("Trackman Summary Card"),
|
| 622 |
sidebarLayout(
|
| 623 |
sidebarPanel(
|
| 624 |
width = 3,
|
|
|
|
| 834 |
geom_point(size = 1, na.rm = TRUE) +
|
| 835 |
scale_color_manual(values = pitch_colors) +
|
| 836 |
theme_minimal() +
|
| 837 |
+
labs(title = paste0(input$rollnum,"-Pitch Rolling TimStuff+"),
|
| 838 |
+
x = "Pitch Number", y = "TimStuff+") +
|
| 839 |
scale_y_continuous(limits = c(70, 130), na.value = NA) +
|
| 840 |
scale_x_continuous(breaks = seq(input$rollnum, max(rolling_data$pitch_number, na.rm = TRUE), by = input$rollnum), limits = c(input$rollnum, NA)) +
|
| 841 |
theme(
|