| year | age | tm | lg | g | pa | ab | r | h | x2b | x3b | hr | rbi | sb | cs | bb | so | ba | obp | slg | ops | ops_2 | tb | gdp | hbp | sh | sf | ibb |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1989 | 19 | SEA | AL | 127 | 506 | 455 | 61 | 120 | 23 | 0 | 16 | 61 | 16 | 7 | 44 | 83 | 0.264 | 0.329 | 0.420 | 0.748 | 108 | 191 | 4 | 2 | 1 | 4 | 8 |
| 1990 | 20 | SEA | AL | 155 | 666 | 597 | 91 | 179 | 28 | 7 | 22 | 80 | 16 | 11 | 63 | 81 | 0.300 | 0.366 | 0.481 | 0.847 | 136 | 287 | 12 | 2 | 0 | 4 | 12 |
| 1991 | 21 | SEA | AL | 154 | 633 | 548 | 76 | 179 | 42 | 1 | 22 | 100 | 18 | 6 | 71 | 82 | 0.327 | 0.399 | 0.527 | 0.926 | 155 | 289 | 10 | 1 | 4 | 9 | 21 |
| 1992 | 22 | SEA | AL | 142 | 617 | 565 | 83 | 174 | 39 | 4 | 27 | 103 | 10 | 5 | 44 | 67 | 0.308 | 0.361 | 0.535 | 0.896 | 149 | 302 | 15 | 5 | 0 | 3 | 15 |
| 1993 | 23 | SEA | AL | 156 | 691 | 582 | 113 | 180 | 38 | 3 | 45 | 109 | 17 | 9 | 96 | 91 | 0.309 | 0.408 | 0.617 | 1.025 | 171 | 359 | 14 | 6 | 0 | 7 | 25 |
| 1994 | 24 | SEA | AL | 111 | 493 | 433 | 94 | 140 | 24 | 4 | 40 | 90 | 11 | 3 | 56 | 73 | 0.323 | 0.402 | 0.674 | 1.076 | 171 | 292 | 9 | 2 | 0 | 2 | 19 |
| 1995 | 25 | SEA | AL | 72 | 314 | 260 | 52 | 67 | 7 | 0 | 17 | 42 | 4 | 2 | 52 | 53 | 0.258 | 0.379 | 0.481 | 0.860 | 122 | 125 | 4 | 0 | 0 | 2 | 6 |
| 1996 | 26 | SEA | AL | 140 | 638 | 545 | 125 | 165 | 26 | 2 | 49 | 140 | 16 | 1 | 78 | 104 | 0.303 | 0.392 | 0.628 | 1.020 | 154 | 342 | 7 | 7 | 1 | 7 | 13 |
| 1997 | 27 | SEA | AL | 157 | 704 | 608 | 125 | 185 | 34 | 3 | 56 | 147 | 15 | 4 | 76 | 121 | 0.304 | 0.382 | 0.646 | 1.028 | 165 | 393 | 12 | 8 | 0 | 12 | 23 |
| 1998 | 28 | SEA | AL | 161 | 720 | 633 | 120 | 180 | 33 | 3 | 56 | 146 | 20 | 5 | 76 | 121 | 0.284 | 0.365 | 0.611 | 0.977 | 150 | 387 | 14 | 7 | 0 | 4 | 11 |
| 1999 | 29 | SEA | AL | 160 | 706 | 606 | 123 | 173 | 26 | 3 | 48 | 134 | 24 | 7 | 91 | 108 | 0.285 | 0.384 | 0.576 | 0.960 | 139 | 349 | 8 | 7 | 0 | 2 | 17 |
| 2000 | 30 | CIN | NL | 145 | 631 | 520 | 100 | 141 | 22 | 3 | 40 | 118 | 6 | 4 | 94 | 117 | 0.271 | 0.387 | 0.556 | 0.942 | 133 | 289 | 7 | 9 | 0 | 8 | 17 |
| 2001 | 31 | CIN | NL | 111 | 417 | 364 | 57 | 104 | 20 | 2 | 22 | 65 | 2 | 0 | 44 | 72 | 0.286 | 0.365 | 0.533 | 0.898 | 124 | 194 | 8 | 4 | 1 | 4 | 6 |
| 2002 | 32 | CIN | NL | 70 | 232 | 197 | 17 | 52 | 8 | 0 | 8 | 23 | 1 | 2 | 28 | 39 | 0.264 | 0.358 | 0.426 | 0.784 | 103 | 84 | 6 | 3 | 0 | 4 | 6 |
| 2003 | 33 | CIN | NL | 53 | 201 | 166 | 34 | 41 | 12 | 1 | 13 | 26 | 1 | 0 | 27 | 44 | 0.247 | 0.370 | 0.566 | 0.936 | 145 | 94 | 3 | 6 | 1 | 1 | 5 |
| 2004 | 34 | CIN | NL | 83 | 348 | 300 | 49 | 76 | 18 | 0 | 20 | 60 | 1 | 0 | 44 | 67 | 0.253 | 0.351 | 0.513 | 0.864 | 123 | 154 | 8 | 2 | 0 | 2 | 3 |
| 2005 | 35 | CIN | NL | 128 | 555 | 491 | 85 | 148 | 30 | 0 | 35 | 92 | 0 | 1 | 54 | 93 | 0.301 | 0.369 | 0.576 | 0.946 | 144 | 283 | 9 | 3 | 0 | 7 | 3 |
| 2006 | 36 | CIN | NL | 109 | 472 | 428 | 62 | 108 | 19 | 0 | 27 | 72 | 0 | 0 | 39 | 78 | 0.252 | 0.316 | 0.486 | 0.802 | 99 | 208 | 13 | 2 | 0 | 3 | 6 |
| 2007 | 37 | CIN | NL | 144 | 623 | 528 | 78 | 146 | 24 | 1 | 30 | 93 | 6 | 1 | 85 | 99 | 0.277 | 0.372 | 0.496 | 0.869 | 119 | 262 | 14 | 1 | 0 | 9 | 14 |
| 2008 | 38 | CIN | NL | 143 | 575 | 490 | 67 | 122 | 30 | 1 | 18 | 71 | 0 | 1 | 78 | 89 | 0.249 | 0.353 | 0.424 | 0.778 | 102 | 208 | 13 | 3 | 0 | 4 | 14 |
| 2009 | 39 | SEA | AL | 117 | 454 | 387 | 44 | 83 | 19 | 0 | 19 | 57 | 0 | 0 | 63 | 80 | 0.214 | 0.324 | 0.411 | 0.735 | 97 | 159 | 6 | 1 | 0 | 3 | 2 |
| 2010 | 40 | SEA | AL | 33 | 108 | 98 | 6 | 18 | 2 | 0 | 0 | 7 | 0 | 0 | 9 | 17 | 0.184 | 0.250 | 0.204 | 0.454 | 30 | 20 | 3 | 0 | 0 | 1 | 0 |
The data I am using for my dashboard is the career statistics of Ken Griffey Jr. I wanted to explore how he got better or worse over his career, as well as the differences in his statistics for the different teams he played on.
Data author: Jarred Priester https://www.kaggle.com/datasets/jarredpriester/ken-griffey-jr-career-stats
---
title: "Ken Griffey Jr. Career Statistics"
author: "Alex Greb"
date: 11/18/24
output:
flexdashboard::flex_dashboard:
orientation: columns # can be rows or columns
vertical_layout: fill # can be scroll or fill
source_code: embed
theme:
bootswatch: lux
navbar:
- { title: "Alex Greb", href: "https://agreb21.github.io", align: right }
- { icon: "fa fa-github", href: "https://github.com/AGreb21", align: right, target: blank }
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(here)
library(janitor)
library(ggthemes)
library(kableExtra)
```
```{r}
griffeydata <- read_csv(here("data/KenGriffyJr.csv"))
griffeydata <- griffeydata %>%
clean_names()
```
```{r}
griffeydata <- griffeydata[-c(21,22), ]
griffeydata <- griffeydata %>%
mutate(tm = ifelse(tm == "TOT", "CIN", tm)) %>%
mutate(lg = ifelse(lg == "MLB", "NL", lg))
```
Column {data-width=350}
-----------------------------------------------------------------------
### Griffey Homeruns By Team
```{r}
homerun_graph <- ggplot(griffeydata, aes(x = tm, y = hr, color = tm)) +
geom_boxplot() +
theme_solarized()+
labs(
#title = "Griffey Homeruns by Team",
x = "Team",
y = "Homeruns"
)
ggplotly(homerun_graph)
```
### Griffey data
```{r}
#starwars <- starwars %>%
# select(name, height, mass, gender, species, homeworld)
knitr::kable(griffeydata) #%>%
#kableExtra::kable_styling(bootstrap_options = c("striped", "hover"), full_width = F) %>%
#kableExtra::scroll_box(width = "30%", height = "300px") %>%
#kableExtra::kable_styling(font_size = 10)
```
Column {data-width=350}
-----------------------------------------------------------------------
### Griffey OPS+ By Season
```{r}
ops_plus_graph <- ggplot(griffeydata, aes(x = year, y = ops_2, color = tm)) +
geom_point() +
labs(
#title = "Griffey OPS+ by season",
x = "Year",
y = "OPS +",
color = "Team"
) +
theme_solarized()+
geom_smooth(color = "black")
ggplotly(ops_plus_graph)
```
### Griffey Batting Average By Year
```{r}
batting_average_graph <- ggplot(griffeydata, aes(x = year, y = ba)) +
geom_line()+
labs(
#title = "Griffey Batting Average by Year",
x = "Year",
y = "Batting Average"
)+
theme_solarized()
ggplotly(batting_average_graph)
```
### Ken Griffey Jr.'s Career Overview
The data I am using for my dashboard is the career statistics of Ken Griffey Jr. I wanted to explore how he got better or worse over his career, as well as the differences in his statistics for the different teams he played on.
Data author: Jarred Priester
https://www.kaggle.com/datasets/jarredpriester/ken-griffey-jr-career-stats