This package scrapes 2017 statistics of active MLB baseball teams and of their players from "http://www.baseball-reference.com/". The package provides two functions: the getPlayers
function scrapes a list of players on a given baseball team; the getStats
function scrapes an individual player's statistics on a given baseball team in a specified area. The package contains a lookup table of active baseball teams' names.
# install.packages('devtools')
library(devtools)
devtools::install_github(repo = "lizeyuyuz/MLBscrapeR")
library(MLBscrapeR)
# to get list of players on an active team
getPlayers(team = "Baltimore Orioles")
# to get fielding statistics of a specific player
getStats(player = "Dylan Bundy", team = "Baltimore Orioles", table = "fielding")
# to get batting statistics of a specific player
getStats(player = "Dylan Bundy", team = "Baltimore Orioles", table = "batting")
# to get pitching statistics of a specific player
getStats(player = "Dylan Bundy", team = "Baltimore Orioles", table = "pitching")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.