Label

0th

Percentile

Extract the Label for a Variable

Extracts the label for a variable from one or more of the *Labels files. This is useful for plots and other displays because the variable names are often cryptically short.

Keywords
manip
Usage
Label(var, labels = rbind(Lahman::battingLabels, 
                          Lahman::pitchingLabels, 
                          Lahman::fieldingLabels))
Arguments
var

name of a variable

labels

label table(s) to search, a 2-column dataframe containing variable names and labels.

Value

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

See Also

battingLabels, pitchingLabels, fieldingLabels

Aliases
  • Label
Examples
# NOT RUN {
require("dplyr")
# find and plot maximum number of homers per year
batHR <- Batting %>%
           filter(!is.na(HR)) %>%
           group_by(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)
	})
# }
Documentation reproduced from package Lahman, version 8.0-0, License: GPL

Community examples

Looks like there are no examples yet.