Skip to contents

Results of NCAA basketball games

Format

Nine 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

season

a character indicating which season the game belonged to

postseason

a logical indicating whether the game is a postseason game

Examples


data(NCAAbb)
# select one year and add some additional variables to the data frame
NCAA2010 <-
  NCAAbb %>% 
  filter(season == "2009-10") %>%
  mutate(
    dscore = hscore - ascore,
    homeTeamWon = dscore > 0,
    numHomeTeamWon <- -1 + 2 * as.numeric(homeTeamWon),
    winner = ifelse(homeTeamWon, home, away),
    loser  = ifelse(homeTeamWon, away, home),
    wscore = ifelse(homeTeamWon, hscore, ascore),
    lscore = ifelse(homeTeamWon, ascore, hscore)
  )
NCAA2010 %>% select(date, winner, loser, wscore, lscore, dscore, homeTeamWon) %>% head()
#> # A tibble: 6 × 7
#>   date       winner         loser               wscore lscore dscore homeTeamWon
#>   <date>     <chr>          <chr>                <int>  <int>  <int> <lgl>      
#> 1 2009-11-09 Ohio St.       Alcorn St.             100     60     40 TRUE       
#> 2 2009-11-09 North Carolina Florida Internatio…     88     72     16 TRUE       
#> 3 2009-11-09 Syracuse       Albany                  75     43     32 TRUE       
#> 4 2009-11-09 California     Murray St.              75     70      5 TRUE       
#> 5 2009-11-11 Syracuse       Robert Morris          100     60     40 TRUE       
#> 6 2009-11-11 North Carolina North Carolina Cen…     89     42     47 TRUE