Label: Extract the Label for a Variable

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Label.R

Description

Extracts the label for a variable from one or more of the *Labels files.

Usage

1

Arguments

var

name of a variable

labels

label table(s) to search, a 2-column dataframe containing variable names and labels. The default is rbind(battingLabels, pitchingLabels, fieldingLabels).

Value

Returns the variable label, or var if no label is found

Author(s)

Michael Friendly

See Also

battingLabels, pitchingLabels, fieldingLabels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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)
	})

Lahman documentation built on May 2, 2019, 5:25 p.m.