# data was manually created
eckel <- cfbd_drives(2022,
season_type = "regular",
team = "North Carolina",
offense_team = "North Carolina") %>%
filter(end_yards_to_goal < 41 | drive_result == "TD") %>%
mutate(id = row_number()) %>%
select(-c(
'offense_conference',
'defense_conference',
'drive_id',
'drive_number'
))
offense <- eckel %>%
mutate(
points = case_when(
drive_result == "TD" ~ "A",
#seven
drive_result == "FG" ~ "B",
#three
drive_result == "DOWNS" ~ "C",
#zero
drive_result == "FUMBLE" ~ "C",
drive_result == "INT" ~ "C",
drive_result == "MISSED FG" ~ "C",
drive_result == "INT TD" ~ "C",
drive_result == "END OF HALF" ~ "C",
drive_result == "END OF GAME" ~ "C",
drive_result == "END OF 4TH QUARTER" ~ "C"
)
) %>%
arrange(points) %>%
group_by(defense) %>%
mutate(counter = row_number()) %>%
ungroup()
off <- offense %>%
mutate(defense = fct_relevel(
defense,
c(
"Florida A&M",
"Appalachian State",
"Georgia State",
"Notre Dame",
"Virginia Tech",
"Miami",
"Duke",
"Pittsburgh",
"Virginia",
"Wake Forest",
"Georgia Tech",
"NC State",
"Clemson"
)
))
eckel_d <- cfbd_drives(2022,
season_type = "regular",
team = "North Carolina",
defense_team = "North Carolina") %>%
filter(end_yards_to_goal < 41 | drive_result == "TD") %>%
mutate(id = row_number()) %>%
select(-c(
'offense_conference',
'defense_conference',
'drive_id',
'drive_number'
))
defense <- eckel_d %>%
mutate(
points = case_when(
drive_result == "TD" ~ "A",
#seven
drive_result == "FG" ~ "B",
#three
drive_result == "DOWNS" ~ "C",
#zero
drive_result == "FUMBLE" ~ "C",
drive_result == "INT" ~ "C",
drive_result == "MISSED FG" ~ "C",
drive_result == "INT TD" ~ "C",
drive_result == "END OF HALF" ~ "C",
drive_result == "PUNT" ~ "C"
)
) %>%
arrange(points) %>%
group_by(offense) %>%
mutate(counter = row_number()) %>%
ungroup()
def <- defense %>%
mutate(offense = fct_relevel(
offense,
c(
"Florida A&M",
"Appalachian State",
"Georgia State",
"Notre Dame",
"Virginia Tech",
"Miami",
"Duke",
"Pittsburgh",
"Virginia",
"Wake Forest",
"Georgia Tech",
"NC State",
"Clemson"
)
)) %>%
mutate(label = case_when(points == "A" ~ 7,
points == "B" ~ 3,
points == "C" ~ 0,))