Spaces:
Build error
Build error
Update app.R
Browse files
app.R
CHANGED
|
@@ -5,14 +5,14 @@ library(utils)
|
|
| 5 |
|
| 6 |
data1 <- read.csv("data1.csv", header = TRUE, check.names = FALSE, fileEncoding = "UTF-8")
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
break_plot_Szn <- function(game,data1,sdate,edate) {
|
| 18 |
game <- game %>% left_join(pitch_type_lookup, by = c("pitch_name"))
|
|
@@ -330,6 +330,17 @@ ui <- fluidPage(
|
|
| 330 |
|
| 331 |
# Define server
|
| 332 |
server <- function(input, output) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
filtered_data <- eventReactive(input$submit, {
|
| 334 |
data1 %>%
|
| 335 |
filter(`Pitcher Name` == input$player,
|
|
|
|
| 5 |
|
| 6 |
data1 <- read.csv("data1.csv", header = TRUE, check.names = FALSE, fileEncoding = "UTF-8")
|
| 7 |
|
| 8 |
+
pitch_type_lookup <- data.frame(
|
| 9 |
+
pitch_name = c("Changeup", "Curveball", "Cutter", "Eephus", "Forkball",
|
| 10 |
+
"Four-Seam Fastball", "Knuckle Ball", "Knuckle Curve",
|
| 11 |
+
"Screwball", "Sinker", "Slider", "Slurve", "Splitter", "Sweeper"),
|
| 12 |
+
pitch_abbr = c("CH", "CU", "FC", "EP", "FO", "FF", "KN", "KC",
|
| 13 |
+
"SC", "SI", "SL", "SV", "FS", "ST"),
|
| 14 |
+
stringsAsFactors = FALSE
|
| 15 |
+
)
|
| 16 |
|
| 17 |
break_plot_Szn <- function(game,data1,sdate,edate) {
|
| 18 |
game <- game %>% left_join(pitch_type_lookup, by = c("pitch_name"))
|
|
|
|
| 330 |
|
| 331 |
# Define server
|
| 332 |
server <- function(input, output) {
|
| 333 |
+
|
| 334 |
+
AAaveragePT <- data1 %>%
|
| 335 |
+
mutate(arm_angle = round(arm_angle, digits = 0)) %>%
|
| 336 |
+
group_by(arm_angle, phand, pitch_name) %>%
|
| 337 |
+
summarise(
|
| 338 |
+
AvgIVB = mean(IVB, na.rm = TRUE),
|
| 339 |
+
AvgHB = mean(HB, na.rm = TRUE),
|
| 340 |
+
.groups = 'drop'
|
| 341 |
+
)
|
| 342 |
+
|
| 343 |
+
|
| 344 |
filtered_data <- eventReactive(input$submit, {
|
| 345 |
data1 %>%
|
| 346 |
filter(`Pitcher Name` == input$player,
|