Learn R Programming

fastR (version 0.10.3)

ncaa2010: NCAA Division I Basketball Results

Description

Results of NCAA basketball games

Arguments

Format

Seven variables describing NCAA Division I basketball games.

  • date date on which game was played

  • away visiting team

  • ascore visiting team's score

  • home home team

  • hscore home team's score

  • notes code indicting games played at neutral sites (n or N) or in tournaments (T)

  • location where game was played

Examples

Run this code
# NOT RUN {
data(ncaa2010)
# add some additional variables to the data frame
ncaa2010$dscore <- ncaa2010$hscore- ncaa2010$ascore
ncaa2010$homeTeamWon <- ncaa2010$dscore > 0
ncaa2010$numHomeTeamWon <- -1 + 2 * as.numeric(ncaa2010$homeTeamWon)
w <- which(ncaa2010$homeTeamWon)
ncaa2010$winner <- as.character(ncaa2010$away)
ncaa2010$winner[w] <- as.character(ncaa2010$home)[w]
ncaa2010$loser <- as.character(ncaa2010$home)
ncaa2010$loser[w] <- as.character(ncaa2010$away)[w]
ncaa2010$homeTeamWon <- ncaa2010$winner == ncaa2010$home
ncaa2010$numHomeTeamWon <- -1 + 2 * as.numeric(ncaa2010$homeTeamWon)

# }

Run the code above in your browser using DataLab