Looking at Baseball Statistics From the Sean Lahman Database
***Work done originally on July 2020***
The data used in this blog is up to the year 2019 during the time I originally made this blog post on my old blog.
Hello world! Time to play ball!!! :)
I was looking into baseball statistics and always wanted to look into baseball statistics especially historical data. Baseball is not only considered by some to be America’s pastime, but also one of the most statistical sports in the world.
I came across the Lahman Baseball database: http://www.seanlahman.com/baseball-archive/statistics/ created by Author and Journalist Sean Lahman which has MLB records of baseball games dating all the way back to 1871. I decided to use the statistical programming language R and Shiny, a R package which one can create interactive web apps.
The app below allows you to enter a baseball player’s first and last name and what kind of data you want to look at. Data is available from 1871 up to 2019. (post season is not included) Available options are
- fielding
- batting
- pitching
For each choice you select, you’ll see the selected baseball player’s stats at the bottom.
Also, for each position you select, you can also select the statistic you want to plot. This will create a bar plot of year vs the statistic you selected.
Check out the app! Learn about baseball player stats and how they were throughout their career. If you want to have baseball conversations and/or debates, pull up this app; it’ll definitely be something to talk about and share with other people.
Last but not least, I want to give a big thanks and shout out to the man himself Sean Lahman for making this data available and free to download. I would not have been able to make the app if it wasn’t for him and his work. Thanks Sean.
Click on the link below and have a blast checking out some MLB stats!!!
https://thatdatascienceguy.shinyapps.io/BaseballApp/
Please note that the app may disconnect if you are not using if after about 15 minutes. Refresh your browser and the app should come up.
Github source code for the app: https://github.com/thatdatascienceguy/thatdatascienceguyblog/tree/master/BaseballApp
shinyapps.io link to the application itself: https://thatdatascienceguy.shinyapps.io/BaseballApp/