# join the data with seeds ncaat_gscores <- gscores |> dplyr::left_join(seeds, by ="team") |> dplyr::relocate(seed, .before = team) |> dplyr::relocate(region, .after = team)
Game Score Function by Region
Code
region_tbl <-function(region) {# Set the title of the plot table_title <-paste0(region, " Region: Range of Game Scores") ncaat_gscores |> dplyr::filter(region == { { region } }) |> dplyr::arrange(seed) |> cbbplotR::gt_cbb_teams(team, team) |> gt::gt() |> gt::fmt_markdown(columns =c(team)) |> gt::cols_hide(columns =c(region)) |> gt::cols_label(seed ="Seed",team ="",record ="W-L",avg ="Avg",avg_last_10 ="Last 10",sum_data ="Change",max_score ="Best Performance",max_game ="",min_score ="Worst Performance",min_game ="" ) |> gt::fmt_number(columns =c(avg, avg_last_10), decimals =1) |> gt::cols_nanoplot(columns = sum_data,reference_line ="mean",autohide =TRUE,new_col_label ="Season Performance",options = gt::nanoplot_options(data_area_fill_color ="#eabfff",reference_line_color ="#333333",show_data_area =TRUE,show_data_points =FALSE ) ) |> cbbplotR::gt_theme_athletic() |> gt::cols_align(align ="left", columns =c(team, max_score, min_score)) |> gtExtras::gt_hulk_col_numeric(columns =c(avg, avg_last_10, max_game, min_game),domain =c(0, 100)) |> gtExtras::gt_add_divider(columns =c(record, avg_last_10, max_game), sides ="right", color ="black") |> gtExtras::gt_add_divider(columns =c(avg), sides ="right",style ="dotted") |> gt::tab_header(title = table_title,subtitle = gt::html("Game Score is from barttorvik.com and calculated on a per game basis. An average score is 50. <br>Shows the season average, average of the last 10, the high/low with results, and the season performance to date.")) |> gt::tab_source_note(source_note = gt::html("<hr><br><b>Viz by Fifth Factor + Bless your chart | data from Bart Torvik, cbbdata, and cbbplotR | March 19, 2024</b>")) |> gt::tab_style(locations = gt::cells_title(groups ="subtitle"),style = gt::cell_text(size ="medium" ) ) |> gt::tab_style(locations = gt::cells_source_notes(),style = gt::cell_text(size ="small" ) ) |> gt::tab_style(style = gt::cell_borders(sides ="top", color ='black', weight = gt::px(1.5), style ='solid'),locations = gt::cells_body(rows = gt::everything() ) ) -> ncaat_region_table ncaat_region_table}
Run and save the function
Code
region_tbl(region ="West") -> west gtExtras::gtsave_extra(west,filename ="nccat_gscore_tbl-w.png",vheight =725,vwidth =1175)region_tbl(region ="East") -> east gtExtras::gtsave_extra(east,filename ="nccat_gscore_tbl-e.png",vheight =725,vwidth =1175)region_tbl(region ="Midwest") -> midwest gtExtras::gtsave_extra(midwest,filename ="nccat_gscore_tbl-mw.png",vheight =725,vwidth =1175)region_tbl(region ="South") -> south gtExtras::gtsave_extra(south,filename ="nccat_gscore_tbl-s.png",vheight =725,vwidth =1175)region_tbl(region ="West")
West Region: Range of Game Scores
Game Score is from barttorvik.com and calculated on a per game basis. An average score is 50.
Shows the season average, average of the last 10, the high/low with results, and the season performance to date.
Seed
W-L
Avg
Last 10
Best Performance
Worst Performance
Season Performance
1
North Carolina
27-7
88.3
87.2
W, Syracuse 103-67
99.5
L, North Carolina St. 76-84
56.6
2
Arizona
25-8
88.7
88.8
W, Colorado 97-50
100.0
L, Stanford 82-100
26.3
3
Baylor
22-10
86.9
86.8
W, Northwestern St. 91-40
99.5
L, Michigan St. 64-88
12.9
4
Alabama
21-11
86.1
77.8
W, South Alabama 102-46
99.6
L, Tennessee 71-91
55.2
5
Saint Mary’s
25-7
81.5
88.1
W, Santa Clara 73-49
99.8
L, Xavier 49-66
15.7
6
Clemson
21-11
80.2
78.0
W, Georgia Tech 81-57
98.8
L, Boston College 55-76
10.2
7
Dayton
24-7
80.8
75.7
W, Grambling St. 76-46
98.6
L, Duquesne 57-65
50.6
8
Mississippi St.
21-13
80.5
82.2
W, Tennessee 73-56
99.8
L, Georgia Tech 59-67
20.7
9
Michigan St.
19-14
84.4
83.0
W, Stony Brook 99-55
99.8
L, Wisconsin 57-70
39.7
10
Nevada
25-7
78.6
86.1
W, Pacific 88-41
99.7
L, New Mexico 55-89
12.1
11
New Mexico
25-9
82.5
81.9
W, Nevada 89-55
99.7
L, Air Force 77-78
27.9
12
Grand Canyon
28-4
72.7
71.8
W, Cal Baptist 68-47
98.3
L, Abilene Christian 73-79
30.9
13
College of Charleston
26-7
64.1
75.5
W, Towson 72-56
97.7
W, William & Mary 84-83
27.9
14
Colgate
24-9
50.9
54.0
W, Binghamton 84-49
97.6
L, Iona 65-85
1.7
15
Long Beach St.
19-14
44.4
41.0
W, Hawaii 79-71
86.6
L, Cal St. Northridge 68-84
5.3
16
Howard
16-16
32.7
33.0
L, Cincinnati 81-86
73.6
L, North Carolina Central 54-73
4.6
16
Wagner
14-15
30.7
34.2
W, Le Moyne 80-57
82.3
L, Stonehill 61-71
2.5
Viz by Fifth Factor + Bless your chart | data from Bart Torvik, cbbdata, and cbbplotR | March 19, 2024