Learn R Programming

nutshell (version 1.02)

field.goals: 2005 Field Goal Attempts

Description

This data set contains information on all 982 field goal attempts during the 2005 NFL season.

Usage

data(field.goals)

Arguments

source

http://www.footballoutsiders.com

Details

This data is provided courtesy of Aaron Schatz, Editor-in-Chief of Football Outsiders a web site about American Football.

This data set is used as an example in the book "R in a Nutshell" from O'Reilly Media.

Examples

Run this code
data(field.goals)
hist(field.goals$yards)
field.goals.forlr <- transform(field.goals,
  good=as.factor(ifelse(play.type=="FG good","good","bad")))
field.goals.table <- table(field.goals.forlr$good,
  field.goals.forlr$yards)
plot(colnames(field.goals.table),
  field.goals.table["good",] /
  (field.goals.table["bad",] +
   field.goals.table["good",]),
  xlab="Distance (Yards)",
  ylab="Percent Good"
)

Run the code above in your browser using DataLab