trelliscope (version 0.9.7)

batting: Lahman's Batting Data for 2014

Description

2014 Batting statistics from Sean Lahman's baseball statistics database (released under CC BY-SA 3.0 license).

Usage

data(batting)

Arguments

Format

A data frame with 1435 rows and 22 variables

Source

Lahman, S. (2015) Lahman's Baseball Database, 1871-2014, 2015 version, http://baseball1.com/statistics/.

Details

  • playerID Player ID code
  • yearID Year
  • stint player's stint (order of appearances within a season)
  • teamID Team; a factor
  • lgID League; a factor with levels AA AL FL NL PL UA
  • G Games: number of games in which a player played
  • AB At Bats
  • R Runs
  • H Hits: times reached base because of a batted, fair ball without error by the defense
  • X2B Doubles: hits on which the batter reached second base safely
  • X3B Triples: hits on which the batter reached third base safely
  • HR Homeruns
  • RBI Runs Batted In
  • SB Stolen Bases
  • CS Caught Stealing
  • BB Base on Balls
  • SO Strikeouts
  • IBB Intentional walks
  • HBP Hit by pitch
  • SH Sacrifice hits
  • SF Sacrifice flies
  • GIDP Grounded into double plays

Examples

Run this code
## Not run: 
# library(lattice)
# 
# vdbConn(tempfile(), autoYes = TRUE)
# 
# # make "splod" directly from a data frame
# splod(batting, name = "batting",
#   id.vars = c("playerID", "yearID", "stint", "teamID", "lgID"))
# 
# # first transform the data into a "splodDat" object
# batSplodDat <- makeSplodData(batting,
#   id.vars = c("playerID", "yearID", "stint", "teamID", "lgID"))
# # now make "splod"
# splod(batSplodDat, name = "batting2", data = batSplodDat)
# 
# # custom panel function (color by league)
# mySplodFn <- function(d) {
#   xyplot(jitter(y) ~ jitter(x), groups = lgID, data = d,
#     xlab = getSplitVar(d, "xVar"),
#     ylab = getSplitVar(d, "yVar"),
#     auto.key = TRUE
#   )
# }
# 
# splod(batSplodDat, name = "batting3",
#   data = batSplodDat, panelFn = mySplodFn)
# 
# view()
# ## End(Not run)

Run the code above in your browser using DataLab