Update app.R
Browse files
app.R
CHANGED
|
@@ -317,11 +317,18 @@ available_stats <- c("Pitches", "Avg Velo", "Top Velo", "TimStuff", "Max EV", "A
|
|
| 317 |
"Spin Rate", "Extension", "IVB", "HB", "CSW%", "Arm Angle", "Bat Speed")
|
| 318 |
|
| 319 |
# Then your UI and server code
|
| 320 |
-
ui <-
|
| 321 |
title = "MLB/AAA/FSL Statcast Data",
|
| 322 |
theme = bs_theme(preset = "united"),
|
| 323 |
-
|
| 324 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
p("X: ", a("(@TimStats)", href = "https://twitter.com/timstats")),
|
| 326 |
p("Data Updated To:", Sys.Date() - 1),
|
| 327 |
|
|
@@ -332,9 +339,9 @@ ui <- page_sidebar(
|
|
| 332 |
multiple = TRUE
|
| 333 |
),
|
| 334 |
selectInput("group", "Group By:",
|
| 335 |
-
c("Pitcher Name", "Pitcher ID", "Pitch Name","Batter Name",
|
| 336 |
-
"Batter ID","Season","Level","Pitch Type","Stadium",
|
| 337 |
-
"Batter Home/Away","Pitcher Home/Away","Pitcher Team",
|
| 338 |
"Batter Team"),
|
| 339 |
multiple = TRUE
|
| 340 |
),
|
|
@@ -342,9 +349,11 @@ ui <- page_sidebar(
|
|
| 342 |
choices = available_stats,
|
| 343 |
multiple = TRUE
|
| 344 |
),
|
| 345 |
-
dateRangeInput("
|
| 346 |
start = "2024-02-23",
|
| 347 |
-
end =
|
|
|
|
|
|
|
| 348 |
)
|
| 349 |
),
|
| 350 |
actionButton("add_filter", "Add Filter", class = "btn-primary mb-3"),
|
|
@@ -352,8 +361,10 @@ ui <- page_sidebar(
|
|
| 352 |
hr(),
|
| 353 |
actionButton("update_table", "Update Table", class = "btn-success")
|
| 354 |
),
|
| 355 |
-
|
| 356 |
-
|
|
|
|
|
|
|
| 357 |
)
|
| 358 |
)
|
| 359 |
|
|
@@ -494,8 +505,8 @@ server <- function(input, output, session) {
|
|
| 494 |
processed_data(),
|
| 495 |
options = list(
|
| 496 |
pagination = TRUE, # Enable pagination
|
| 497 |
-
paginationSize =
|
| 498 |
-
paginationSizeSelector = c(10,
|
| 499 |
selectable = TRUE,
|
| 500 |
layout = "fitColumns",
|
| 501 |
columns = column_defs
|
|
|
|
| 317 |
"Spin Rate", "Extension", "IVB", "HB", "CSW%", "Arm Angle", "Bat Speed")
|
| 318 |
|
| 319 |
# Then your UI and server code
|
| 320 |
+
ui <- page_fluid(
|
| 321 |
title = "MLB/AAA/FSL Statcast Data",
|
| 322 |
theme = bs_theme(preset = "united"),
|
| 323 |
+
layout_columns(
|
| 324 |
+
col_width(4, xs = 12, sm = 12, md = 4, lg = 3, xl = 3),
|
| 325 |
+
col_width(8, xs = 12, sm = 12, md = 8, lg = 9, xl = 9)
|
| 326 |
+
),
|
| 327 |
+
|
| 328 |
+
# Left column (sidebar)
|
| 329 |
+
card(
|
| 330 |
+
full_screen = FALSE,
|
| 331 |
+
height = "100%",
|
| 332 |
p("X: ", a("(@TimStats)", href = "https://twitter.com/timstats")),
|
| 333 |
p("Data Updated To:", Sys.Date() - 1),
|
| 334 |
|
|
|
|
| 339 |
multiple = TRUE
|
| 340 |
),
|
| 341 |
selectInput("group", "Group By:",
|
| 342 |
+
c("Pitcher Name", "Pitcher ID", "Pitch Name", "Batter Name",
|
| 343 |
+
"Batter ID", "Season", "Level", "Pitch Type", "Stadium",
|
| 344 |
+
"Batter Home/Away", "Pitcher Home/Away", "Pitcher Team",
|
| 345 |
"Batter Team"),
|
| 346 |
multiple = TRUE
|
| 347 |
),
|
|
|
|
| 349 |
choices = available_stats,
|
| 350 |
multiple = TRUE
|
| 351 |
),
|
| 352 |
+
dateRangeInput("date_range", "Date Range:",
|
| 353 |
start = "2024-02-23",
|
| 354 |
+
end = Sys.Date() - 1,
|
| 355 |
+
min = "2024-02-23",
|
| 356 |
+
max = Sys.Date() - 1
|
| 357 |
)
|
| 358 |
),
|
| 359 |
actionButton("add_filter", "Add Filter", class = "btn-primary mb-3"),
|
|
|
|
| 361 |
hr(),
|
| 362 |
actionButton("update_table", "Update Table", class = "btn-success")
|
| 363 |
),
|
| 364 |
+
|
| 365 |
+
# Right column (main content)
|
| 366 |
+
card(
|
| 367 |
+
tabulatorOutput("table", height = "800px")
|
| 368 |
)
|
| 369 |
)
|
| 370 |
|
|
|
|
| 505 |
processed_data(),
|
| 506 |
options = list(
|
| 507 |
pagination = TRUE, # Enable pagination
|
| 508 |
+
paginationSize = 20, # Set page size to 10 rows
|
| 509 |
+
paginationSizeSelector = c(10, 20, 50, 100), # Allow users to change page size
|
| 510 |
selectable = TRUE,
|
| 511 |
layout = "fitColumns",
|
| 512 |
columns = column_defs
|