Description Usage Format Details Source Examples
2014 Batting statistics from Sean Lahman's baseball statistics database (released under CC BY-SA 3.0 license).
1 |
A data frame with 1435 rows and 22 variables
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
Lahman, S. (2015) Lahman's Baseball Database, 1871-2014, 2015 version, http://baseball1.com/statistics/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.