TimStats commited on
Commit
b972397
·
verified ·
1 Parent(s): 6a1d4a4

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +3 -3
app.R CHANGED
@@ -58,7 +58,7 @@ apply_percentile_calcs <- function(data) {
58
  `Batter Name` = data[["Batter Name"]],
59
  `Batter ID` = data[["Batter ID"]],
60
  metric = col,
61
- percentile = round(percent_rank(data[[col]]) * 100),
62
  value = data[[col]],
63
  stringsAsFactors = FALSE
64
  )
@@ -69,7 +69,7 @@ apply_percentile_calcs <- function(data) {
69
  `Batter Name` = data[["Batter Name"]],
70
  `Batter ID` = data[["Batter ID"]],
71
  metric = col,
72
- percentile = round((1 - percent_rank(data[[col]])) * 100),
73
  value = data[[col]],
74
  stringsAsFactors = FALSE
75
  )
@@ -261,7 +261,7 @@ ui <- fluidPage(
261
  sidebarPanel(
262
  selectInput("szn", "Season:", c(2026, 2025, 2024, 2023, 2022, 2021)),
263
  selectInput("level", "Level:", c("MLB", "AAA", "FSL")),
264
- selectInput("type", "Player Type:", c("Batter", "Pitcher")),
265
  selectInput("player", "Player:", choices = unique(temp_players$`Batter Name`)),
266
  checkboxInput("use_custom_team", "Use Custom Team", FALSE),
267
  conditionalPanel(
 
58
  `Batter Name` = data[["Batter Name"]],
59
  `Batter ID` = data[["Batter ID"]],
60
  metric = col,
61
+ percentile = pmax(1, round(percent_rank(data[[col]]) * 100)),
62
  value = data[[col]],
63
  stringsAsFactors = FALSE
64
  )
 
69
  `Batter Name` = data[["Batter Name"]],
70
  `Batter ID` = data[["Batter ID"]],
71
  metric = col,
72
+ percentile = pmax(1, round((1 - percent_rank(data[[col]])) * 100)),
73
  value = data[[col]],
74
  stringsAsFactors = FALSE
75
  )
 
261
  sidebarPanel(
262
  selectInput("szn", "Season:", c(2026, 2025, 2024, 2023, 2022, 2021)),
263
  selectInput("level", "Level:", c("MLB", "AAA", "FSL")),
264
+ selectInput("type", "Player Type:", c("Batter")),
265
  selectInput("player", "Player:", choices = unique(temp_players$`Batter Name`)),
266
  checkboxInput("use_custom_team", "Use Custom Team", FALSE),
267
  conditionalPanel(