Last data update: 2014.03.03

R: Variable Labels
battingLabelsR Documentation

Variable Labels

Description

These data frames provide descriptive labels for the variables in the Batting, Pitching and Fielding files (and related *Post files). They are useful for plots and other output using Label.

Usage

data(battingLabels)

data(fieldingLabels)

data(pitchingLabels)

Format

Each is data frame with observations on the following 2 variables.

variable

variable name

label

variable label

See Also

Label

Examples

data(battingLabels)
str(battingLabels)

require(plyr)
# find and plot maximum number of homers per year
batHR <- ddply(subset(Batting, !is.na(HR)), .(yearID),
		summarise, max=max(HR))
		
with(batHR, {
  plot(yearID, max, 
       xlab=Label("yearID"), ylab=paste("Maximum", Label("HR")), 
       cex=0.8)
  lines(lowess(yearID, max), col="blue", lwd=2)
  abline(lm(max ~ yearID), col="red", lwd=2)
	})

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Lahman)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Lahman/battingLabels.Rd_%03d_medium.png", width=480, height=480)
> ### Name: battingLabels
> ### Title: Variable Labels
> ### Aliases: fieldingLabels pitchingLabels battingLabels
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data(battingLabels)
> str(battingLabels)
'data.frame':	22 obs. of  2 variables:
 $ variable: chr  "playerID" "yearID" "stint" "teamID" ...
 $ label   : chr  "Player ID code" "Year" "Player's stint" "Team" ...
> 
> require(plyr)
Loading required package: plyr
> # find and plot maximum number of homers per year
> batHR <- ddply(subset(Batting, !is.na(HR)), .(yearID),
+ 		summarise, max=max(HR))
> 		
> with(batHR, {
+   plot(yearID, max, 
+        xlab=Label("yearID"), ylab=paste("Maximum", Label("HR")), 
+        cex=0.8)
+   lines(lowess(yearID, max), col="blue", lwd=2)
+   abline(lm(max ~ yearID), col="red", lwd=2)
+ 	})
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>