Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -41,12 +41,13 @@ load_portal <- function() {
|
|
| 41 |
df <- arrow::read_parquet("/app/transfer_portal.parquet")
|
| 42 |
names(df) <- tolower(names(df))
|
| 43 |
df %>%
|
| 44 |
-
rename(Pitcher=pitcher, Portal=transfer,
|
|
|
|
| 45 |
distinct(Pitcher, .keep_all = TRUE)
|
| 46 |
}, error = function(e) {
|
| 47 |
message("Portal load failed: ", e$message)
|
| 48 |
-
tibble(Pitcher=character(), Portal=character(),
|
| 49 |
-
ERA=numeric(), FIP=numeric(), WHIP=numeric())
|
| 50 |
})
|
| 51 |
}
|
| 52 |
|
|
@@ -108,7 +109,7 @@ build_pitcher_table <- function(lb, min_pitches, portal_only) {
|
|
| 108 |
)
|
| 109 |
if (portal_only) df <- df %>% filter(Portal == "Yes")
|
| 110 |
df %>%
|
| 111 |
-
select(Name, Level, Team, Portal, `Plot`, `Twitter`, HomeState, Height, Weight,
|
| 112 |
Pitches, ERA, FIP, WHIP, `FB Velo`, `Zone%`, `Strike%`,
|
| 113 |
`K's`, `BB's`, `K/BB`, `Whiff%`, `Chase%`, `Hard Hit%`,
|
| 114 |
`GB%`, `FB%`, `LD%`, `Stuff+`, `Location+`) %>%
|
|
|
|
| 41 |
df <- arrow::read_parquet("/app/transfer_portal.parquet")
|
| 42 |
names(df) <- tolower(names(df))
|
| 43 |
df %>%
|
| 44 |
+
rename(Pitcher = pitcher, Portal = transfer, Throws = throws,
|
| 45 |
+
HomeState = homestate, ERA = era, FIP = fip, WHIP = whip) %>%
|
| 46 |
distinct(Pitcher, .keep_all = TRUE)
|
| 47 |
}, error = function(e) {
|
| 48 |
message("Portal load failed: ", e$message)
|
| 49 |
+
tibble(Pitcher=character(), Portal=character(), Throws=character(),
|
| 50 |
+
HomeState=character(), ERA=numeric(), FIP=numeric(), WHIP=numeric())
|
| 51 |
})
|
| 52 |
}
|
| 53 |
|
|
|
|
| 109 |
)
|
| 110 |
if (portal_only) df <- df %>% filter(Portal == "Yes")
|
| 111 |
df %>%
|
| 112 |
+
select(Name, Level, Team, Portal, `Plot`, `Twitter`, HomeState, Throws, Height, Weight,
|
| 113 |
Pitches, ERA, FIP, WHIP, `FB Velo`, `Zone%`, `Strike%`,
|
| 114 |
`K's`, `BB's`, `K/BB`, `Whiff%`, `Chase%`, `Hard Hit%`,
|
| 115 |
`GB%`, `FB%`, `LD%`, `Stuff+`, `Location+`) %>%
|