igroffman commited on
Commit
f6a438f
·
verified ·
1 Parent(s): 73e80cd

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +17 -16
app.R CHANGED
@@ -401,22 +401,23 @@ server <- function(input, output, session){
401
  if (nrow(hit)==1) show_pitch_modal(hit)
402
  })
403
 
404
- # ---- Selected pitch info in modal ----
405
- output$selected_pitch_info <- renderText({
406
- info <- selected_pitch()
407
- if (is.null(info)) return("No pitch selected")
408
- d <- info$data
409
- paste(
410
- paste("Pitcher:", info$pitcher),
411
- paste("Current Type:", d$TaggedPitchType),
412
- paste("Velocity:", round(d$RelSpeed,1), "mph"),
413
- paste("Horizontal Break:", round(d$HorzBreak,1), "inches"),
414
- paste("Induced Vertical Break:", round(d$InducedVertBreak,1), "inches"),
415
- if ("SpinRate" %in% names(d) && !is.na(d$SpinRate)) paste("Spin Rate:", round(d$SpinRate,0), "rpm") else "",
416
- if ("Date" %in% names(d) && !is.na(d$Date)) paste("Date:", format(as.Date(d$Date))) else "",
417
- sep = "\n"
418
- )
419
- })
 
420
 
421
  observeEvent(input$update_pitch, {
422
  info <- selected_pitch()
 
401
  if (nrow(hit)==1) show_pitch_modal(hit)
402
  })
403
 
404
+ output$selected_pitch_info <- renderText({
405
+ info <- selected_pitch()
406
+ if (is.null(info)) return("No pitch selected")
407
+ d <- info$data
408
+
409
+ paste(
410
+ paste("Pitcher:", info$pitcher),
411
+ if ("PitchNo" %in% names(d) && !is.na(d$PitchNo)) paste("PitchNo:", d$PitchNo) else "",
412
+ paste("Current Type:", d$TaggedPitchType),
413
+ paste("Velocity:", round(d$RelSpeed, 1), "mph"),
414
+ paste("Horizontal Break:", round(d$HorzBreak, 1), "inches"),
415
+ paste("Induced Vertical Break:", round(d$InducedVertBreak, 1), "inches"),
416
+ if ("SpinRate" %in% names(d) && !is.na(d$SpinRate)) paste("Spin Rate:", round(d$SpinRate, 0), "rpm") else "",
417
+ if ("Date" %in% names(d) && !is.na(d$Date)) paste("Date:", format(as.Date(d$Date))) else "",
418
+ sep = "\n"
419
+ )
420
+ })
421
 
422
  observeEvent(input$update_pitch, {
423
  info <- selected_pitch()