This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# INDIVIDUAL TEAM HISTORY - RUNS ALLOWED | |
# | |
# select the team you want from the franchID variable in the Teams.merge data frame | |
# and create a new data frame called "Team1" | |
# note the use of double "=" to define the team! | |
Team1 <- as.data.frame(subset (Teams.merge, franchID == "SEA")) | |
# | |
# create what will be the chart title from the contents of Team1 | |
# note that teams sprang into existence in different years, thus the requirement to define both the start and end dates | |
firstyear <- Team1$yearID[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THE HISTORICAL RECORD - RUNS PER GAME | |
# | |
# discussion and output can be found at | |
# http://bayesball.blogspot.ca/2013/02/comparing-individual-team-run-production.html | |
# | |
# data source: Lahman Database | |
# http://www.seanlahman.com/baseball-archive/statistics/ | |
# 2012 version (1871-2012) | |
# table: "Teams" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MAJOR LEAGUE BASEBALL - RUNS PER GAME TREND | |
# | |
# discussion at | |
# 1. http://bayesball.blogspot.ca/2012/07/trends-in-al-run-scoring-using-r.html | |
# 2. http://bayesball.blogspot.ca/2012/07/trends-in-run-scoring-nl-edition-more-r.html | |
# 3. http://bayesball.blogspot.ca/2012/08/trends-in-run-scoring-comparing-leagues.html | |
# | |
# data source: Baseball Reference | |
# http://www.baseball-reference.com | |
# http://www.baseball-reference.com/leagues/AL/bat.shtml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# INDIVIDUAL TEAM HISTORY | |
# | |
# discussion and output can be found at | |
# http://bayesball.blogspot.ca/XXXXXXXXXXXXXXXXXXXXX | |
# | |
# Select the team you want from the franchID variable in the Teams.merge data frame | |
# and create a new data frame called "Team1" | |
# For this exercise we will use the Seattle Mariners, which are coded as SEA | |
# Note the use of double "=" to define the team! | |
Team1 <- as.data.frame(subset (Teams.merge, franchID == "SEA")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THE HISTORICAL RECORD - RUNS PER GAME BY TEAM | |
# | |
# public Gist of this code can be found at | |
# https://gist.github.com/MonkmanMH/4720641 | |
# | |
# data source: Lahman Database | |
# http://www.seanlahman.com/baseball-archive/statistics/ | |
# 2012 version (1871-2012) | |
# data table "Teams.csv" | |
# |
NewerOlder