DaveM2430 commited on
Commit
f1fbe98
·
verified ·
1 Parent(s): 6c03b9d

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +4 -5
app.R CHANGED
@@ -34,9 +34,8 @@ build_pitcher_stats <- function(df, min_pitches) {
34
  IsPA = (!is.na(KorBB) & KorBB %in% c("Strikeout","Walk")) |
35
  (!is.na(PitchCall) & PitchCall %in% c("InPlay","HitByPitch"))
36
  ) %>%
37
- group_by(Pitcher, Level) %>%
38
  summarise(
39
- Team = PitcherTeam,
40
  Pitches = n(),
41
  K = sum(IsK, na.rm=TRUE),
42
  BB = sum(IsBB, na.rm=TRUE),
@@ -77,7 +76,7 @@ build_pitcher_stats <- function(df, min_pitches) {
77
  # must have both first and last name (at least one space)
78
  grepl(" ", trimws(Name))
79
  ) %>%
80
- select(Name, Level, Team, Pitches, `Zone%`, `Strike%`, `K's`, `BB's`,
81
  `K/BB`, `Whiff%`, `Chase%`, `Hard Hit%`) %>%
82
  arrange(desc(Pitches))
83
  }
@@ -264,8 +263,8 @@ output$pitcher_table <- renderDT({
264
  order = list(list(2, "desc")),
265
  dom = "lfrtip",
266
  columnDefs = list(
267
- list(className="dt-center", targets=1:10),
268
- list(className="dt-left", targets=0)
269
  )
270
  )
271
  )
 
34
  IsPA = (!is.na(KorBB) & KorBB %in% c("Strikeout","Walk")) |
35
  (!is.na(PitchCall) & PitchCall %in% c("InPlay","HitByPitch"))
36
  ) %>%
37
+ group_by(Pitcher, Level, PitcherTeam) %>%
38
  summarise(
 
39
  Pitches = n(),
40
  K = sum(IsK, na.rm=TRUE),
41
  BB = sum(IsBB, na.rm=TRUE),
 
76
  # must have both first and last name (at least one space)
77
  grepl(" ", trimws(Name))
78
  ) %>%
79
+ select(Name, Level, Team=PitcherTeam, Pitches, `Zone%`, `Strike%`, `K's`, `BB's`,
80
  `K/BB`, `Whiff%`, `Chase%`, `Hard Hit%`) %>%
81
  arrange(desc(Pitches))
82
  }
 
263
  order = list(list(2, "desc")),
264
  dom = "lfrtip",
265
  columnDefs = list(
266
+ list(className="dt-center", targets=2:11),
267
+ list(className="dt-left", targets=0:1)
268
  )
269
  )
270
  )