![]() # get the teamIDĭplyr::filter(yearID = 1933 & str_detect(name, "Senators")) %>%ĭplyr::filter(yearID = 2018 & str_detect(name, "Nationals")) %>% The code chunk below identifies the teamID for each Washington team. We’ll extract the historical data leading up the World Series appearance. We are going to explore the relationship between runs and wins for the 1933 Washington Senators, and for the current Washington Nationals. This is the first World Series appearance for the Washington Nationals since 1933 (who were then known as the Senators). The series went all seven games, and the Nationals miraculously won all on their games while they were the away team. The Washington Nationals just won the World Series on October 30th, 2019. We will need Lahman and the tidyverse packages for this tutorial, so we load them below. The Lahman R package contains all the tables from the ‘Sean Lahman Baseball Database.’ Lahman is a hero for sports stats junkies because he’s worked so hard to make sports data freely available. ![]() Just about everything gets measured and, thanks to Sean Lahman, those measurements are available to analyze. Getting baseball dataīaseball is one of the most quantified sports on the planet. And if you’ve been following along with Data Journalism wtih R, you know that means the code in the book is easier to read and there are some solid underlying principles. ![]() This is the second edition of the text, and most of the changes are converting the previous edition to tidyverse principles. This tutorial is based in part on the excellent book that came out last year, “Analyzing Baseball Data with R” by Max Marchi, Jim Albert, and Ben Baumer. There are a ton of books, blog posts, and lectures covering these topics in greater depth (and we’ll link to those in the notes at the bottom), but we wanted to distill some of this information into a single post you can bookmark and revisit whenever you’re considering running a linear regression. ![]() In this post we’ll cover the assumptions of a linear regression model.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |