-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPitching.Rmd
38 lines (30 loc) · 1.02 KB
/
Pitching.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
title: "Pitching"
author: "Jesse Wade"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,
include=FALSE)
```
```{r libraries, include=FALSE}
library(Lahman)
library(tidyverse)
```
### Pitching Stats by Year
```{r First_Pitch}
Pitching %>%
filter(yearID > 1950) %>%
group_by(lgID,yearID) %>%
summarise(TotalStrikeouts=sum(SO),AverageStikeOutsPerGame=mean(SO/G)) %>%
select(lgID,yearID,TotalStrikeouts,AverageStikeOutsPerGame) -> StrikeoutsbyLeague
TotalLeagueStrikeouts <- ggplot(StrikeoutsbyLeague,aes(x=yearID,y=TotalStrikeouts)) + geom_line(aes(color=lgID),linewidth=1.4)+labs(title="Strikeout Totals By League, 1950-2022")
TotalLeagueStrikeouts
StrikeoutsPerGame<- ggplot(StrikeoutsbyLeague,aes(x=yearID,y=AverageStikeOutsPerGame)) + geom_line(aes(color=lgID),linewidth=1.4)+labs(title="Average Strikeouts per Game Pitched By League, 1950-2022")
StrikeoutsPerGame
```
```{r G_1,include=TRUE}
TotalLeagueStrikeouts
StrikeoutsPerGame
```