### Example of cbd_torvik_team_schedule Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_schedule.html Example demonstrating how to fetch the schedule for a specific team and year. ```R try(cbd_torvik_team_schedule(team = 'Duke', year = 2023)) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Install cbbdata Package Source: https://cbbdata.aweatherman.com/articles/release.html Install the cbbdata package from GitHub using the devtools package. Ensure devtools is installed first. ```R # install.packages("devtools") devtools::install_github("andreweatherman/cbbdata") ``` -------------------------------- ### Example: Retrieve 2023 Conference Factors Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_conf_factors.html Demonstrates how to call the function for the 2023 season with a specific start date. ```R try(cbd_torvik_conf_factors(2023, start = '20230101')) ``` -------------------------------- ### Example: Get Committee Tournament Sheets for 2019 Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_ncaa_sheets.html This example demonstrates how to call the `cbd_torvik_ncaa_sheets` function for the year 2019 and displays the resulting tibble, which includes team, seed, and various ranking metrics. ```R try(cbd_torvik_ncaa_sheets(year=2019)) ``` -------------------------------- ### Example of cbd_torvik_ratings Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_ratings.html Example demonstrating how to filter ratings by year. ```R try(cbd_torvik_ratings(year = 2023)) ``` -------------------------------- ### Example usage of cbd_torvik_similar_resumes Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_similar_resumes.html Demonstrates a basic function call to retrieve similar resumes for Duke in 2023. ```R try(cbd_torvik_similar_resumes('Duke', 2023)) #> Error in ifelse(at_large_only = TRUE, 1, 0) : #> unused argument (at_large_only = TRUE) ``` -------------------------------- ### Example of cbd_bpi_ratings usage Source: https://cbbdata.aweatherman.com/reference/cbd_bpi_ratings.html Demonstrates filtering the BPI ratings by conference. ```R try(cbd_bpi_ratings(conf = 'ACC')) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Example usage of cbd_torvik_player_split Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_player_split.html Demonstrates how to call the function with specific filters for year, team, and split type. ```R try(cbd_torvik_player_split(year = 2023, team = 'Duke', split = 'game_result')) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Call cbd_torvik_team_split with month split Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_split.html Example of calling `cbd_torvik_team_split` to get data split by month for the year 2023. This function requires prior login, which may involve restarting the R session if it's the first time. ```R try(cbd_torvik_team_split(year = 2023, split = 'month')) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Load KenPom Ratings for a Specific Year Source: https://cbbdata.aweatherman.com/reference/cbd_kenpom_ratings_archive.html This example demonstrates how to load the complete KenPom data set for a specific year. Ensure you have KenPom authorization set up. ```R try(cbd_kenpom_ratings_archive(year = 2023)) ``` -------------------------------- ### Example AP Poll Query Source: https://cbbdata.aweatherman.com/reference/cbd_ap_rankings.html Demonstrates a query attempt for Duke's AP poll history. ```R try(cbd_ap_polls(team = "Duke")) #> Error in cbd_ap_polls(team = "Duke") : #> could not find function "cbd_ap_polls" ``` -------------------------------- ### GET cbd_teams Source: https://cbbdata.aweatherman.com/reference/cbd_teams.html Retrieves the team matching dictionary along with team logos, colors, and wordmarks. ```APIDOC ## GET cbd_teams ### Description Pulls the team matching dictionary, including logos, colors, and wordmarks for college basketball teams. ### Method GET ### Endpoint cbd_teams(...) ### Parameters #### Arguments - **...** (optional) - Pass no arguments to load the complete data set. ### Request Example ```r try(cbd_teams()) ``` ### Response #### Success Response (200) - **data** (object) - Returns a dataset containing team matching information, logos, colors, and wordmarks. ``` -------------------------------- ### Get Selection Sunday Resumes Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_resume_database.html Retrieves a tibble with resume-based metrics for college basketball teams from 2008 to the present. Use arguments to filter by number of teams, year range, and NET ranking. ```R cbd_torvik_resume_database( n = 500, min_year = 2008, max_year = 2024, min_net = NULL, max_net = NULL, conf_group = NULL ) ``` ```R try(cbd_torvik_resume_database(min_net = 1, max_net = 5)) ``` -------------------------------- ### Get Selection Sunday Resumes Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_resume_database.html Retrieves a tibble containing various resume-based metrics for college basketball teams through Selection Sunday. The data spans from 2008 to the present. ```APIDOC ## GET /api/torvik/resume ### Description Retrieves a tibble with various resume-based metrics through Selection Sunday. Data runs from 2008-present. ### Method GET ### Endpoint /api/torvik/resume ### Query Parameters - **n** (integer) - Optional - Number of teams to return (defaults to 500). - **min_year** (integer) - Optional - Minimum year to pull (YYYY). - **max_year** (integer) - Optional - Maximum year to pull (YYYY). - **min_net** (integer) - Optional - Minimum NET to filter. - **max_net** (integer) - Optional - Maximum NET to filter. - **conf_group** (string) - Optional - Filter by conference or conference groups (accepts any conference abbreviation, 'NCAA', 'Himajor', or 'mid'). ### Response #### Success Response (200) - **team** (string) - Team name. - **year** (string) - Year of the data. - **net** (string) - NET ranking. - **resume** (string) - Resume metric. - **wab** (string) - Wins Above Bubble metric. - **elo** (string) - Elo rating. - **power** (string) - Power rating. - **q1_w** (string) - Quadrant 1 Wins. - **q2_w** (string) - Quadrant 2 Wins. - **q3q4_l** (string) - Quadrant 3/4 Losses. - **games_above_500** (integer) - Games above .500. - **score** (string) - Score metric. - **seed** (string) - Tournament seed. - **type** (string) - Team type. - **rd** (string) - Tournament round reached. ### Request Example ```json { "n": 500, "min_year": 2008, "max_year": 2024, "min_net": 1, "max_net": 5, "conf_group": "NCAA" } ``` ### Response Example ```json { "data": [ { "team": "Kansas", "year": "2016", "net": "1", "resume": "1", "wab": "1", "elo": "1", "power": "1", "q1_w": "15", "q2_w": "20", "q3q4_l": "1", "games_above_500": 25, "score": "1", "seed": "1", "type": "1", "rd": "1" } // ... more team data ] } ``` ``` -------------------------------- ### GET /cbd_all_metrics Source: https://cbbdata.aweatherman.com/reference/cbd_all_metrics.html Retrieves a consolidated tibble containing T-Rank, WAB, KP, BPI, SOR/SOS, and NET metrics. ```APIDOC ## GET cbd_all_metrics ### Description Retrieves T-Rank, WAB, KP, BPI, SOR/SOS, and NET metrics in a single tibble. ### Method GET ### Endpoint cbd_all_metrics(...) ### Request Example ```r cbd_all_metrics() ``` ### Response #### Success Response (200) - **data** (tibble) - A tibble containing T-Rank, WAB, KP, BPI, SOR/SOS, and NET metrics. ``` -------------------------------- ### GET /cbd_torvik_game_box Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_box.html Retrieves final game box statistics from Barttorvik for seasons ranging from 2008 to the present. ```APIDOC ## GET /cbd_torvik_game_box ### Description Pulls final game box stats from 2008-Present. ### Method GET ### Endpoint /cbd_torvik_game_box ### Parameters #### Query Parameters - **year** (integer) - Optional - Filter by season year - **team** (string) - Optional - Filter by team name - **date** (string) - Optional - Filter by game date - **conf** (string) - Optional - Filter by conference ``` -------------------------------- ### GET cbd_torvik_game_factors Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_factors.html Retrieves final game four factors statistics from 2008-Present with optional filtering capabilities. ```APIDOC ## GET cbd_torvik_game_factors ### Description Pulls final game four factors stats from 2008-Present. ### Method GET ### Endpoint cbd_torvik_game_factors(...) ### Parameters #### Query Parameters - **...** (dots) - Optional - Arguments to filter the data set. Can filter on `year`, `team`, `date`, `conf`, or any other data column. If no arguments are passed, the complete data set is returned. ``` -------------------------------- ### GET cbd_torvik_game_stats Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_stats.html Retrieves full game statistics from Barttorvik. Users can either fetch the complete dataset or apply filters. ```APIDOC ## GET cbd_torvik_game_stats ### Description Retrieves full game statistics from Barttorvik. If no arguments are provided, the complete dataset is returned. Otherwise, results can be filtered by specific criteria. ### Method GET ### Parameters #### Query Parameters - **year** (integer) - Optional - Filter by season year. - **team** (string) - Optional - Filter by team name. - **date** (string) - Optional - Filter by game date. - **conf** (string) - Optional - Filter by conference. ### Response #### Success Response (200) - **data** (object) - Returns a data frame containing the requested Barttorvik game statistics. ``` -------------------------------- ### GET cbd_bpi_ratings Source: https://cbbdata.aweatherman.com/reference/cbd_bpi_ratings.html Retrieves current BPI ratings and ESPN projections, with optional filtering by team or conference. ```APIDOC ## GET cbd_bpi_ratings ### Description Pulls current BPI ratings and ESPN season and tournament projections. ### Method GET ### Endpoint cbd_bpi_ratings(...) ### Parameters #### Query Parameters - **team** (string) - Optional - Filter results by specific team. - **conf** (string) - Optional - Filter results by specific conference. ### Request Example cbd_bpi_ratings(conf = 'ACC') ### Response #### Success Response (200) - **data** (object) - Returns a dataset containing BPI ratings and ESPN projections. ``` -------------------------------- ### GET /cbd_torvik_current_resume Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_current_resume.html Retrieves a tibble containing current NCAA Tournament resume data, including rankings, ratings, and quadrant records. ```APIDOC ## GET cbd_torvik_current_resume ### Description Returns a tibble with current NCAA Tournament resume data. ### Method GET ### Endpoint cbd_torvik_current_resume() ### Response #### Success Response (200) - **seed** (integer) - NCAA Seed - **team** (string) - Team - **conf** (string) - Conference - **barthag** (numeric) - Barthag rating - **t_rank** (integer) - Barthag rank - **net** (integer) - NCAA Net rank - **elo** (integer) - ELO rank - **resume** (integer) - Resume rank - **wab_rk** (integer) - Wins Above Bubble ranking - **wab** (numeric) - Wins above/below bubble team expectation - **quad1** (string) - Quad 1 record - **quad2** (string) - Quad 2 record - **quad3** (string) - Quad 3 record - **quad4** (string) - Quad 4 record - **adj_o** (numeric) - Adjusted offense - **adj_o_rk** (integer) - Adjusted offense rank - **adj_d** (numeric) - Adjusted defense - **adj_d_rk** (integer) - Adjusted defense rank - **adj_t** (numeric) - Adjusted tempo - **adj_t_rk** (integer) - Adjusted tempo rank ### Request Example try(cbd_torvik_current_resume()) ``` -------------------------------- ### GET cbd_torvik_team_factors Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_factors.html Retrieves team-wide four factor data split by specified variables. ```APIDOC ## GET cbd_torvik_team_factors ### Description Split team-wide four factor data on a number of variables. ### Method GET ### Parameters #### Query Parameters - **year** (integer) - Optional - Chosen year - **venue** (string) - Optional - Game venue ('all', 'home', 'away', 'neutral', 'road'). Defaults to 'all'. - **game_type** (string) - Optional - Game type ('all', 'nc', 'conf', 'reg', 'post', 'ncaa'). Defaults to 'all'. - **quad** (string) - Optional - Quad rank of game ('1', '2', '3', '4', 'all'). Defaults to '4'. - **top** (integer) - Optional - Games against Top X opponents. Defaults to 0. - **start** (string) - Optional - Game start date (YYYYMMDD format). - **end** (string) - Optional - Game end date (YYYYMMDD format). - **no_bias** (boolean) - Optional - If TRUE, displays T-Rank ratings with no preseason bias/weight. ### Response #### Success Response (200) - **data** (tibble) - Returns a tibble containing four factor and other related data. ``` -------------------------------- ### GET cbd_torvik_season_schedule Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_season_schedule.html Retrieves college basketball season schedules from Barttorvik. Users can specify a year or leave arguments empty to load the complete dataset. ```APIDOC ## GET cbd_torvik_season_schedule ### Description Pulls season schedules from Barttorvik. ### Method GET ### Parameters #### Query Parameters - **year** (integer) - Optional - The season year to retrieve. If no arguments are passed, the complete data set is loaded. ``` -------------------------------- ### GET /cbd_kenpom_ratings Source: https://cbbdata.aweatherman.com/reference/cbd_kenpom_ratings.html Retrieves year-end KenPom ratings and adjusted efficiencies. Users can filter the results by passing specific arguments. ```APIDOC ## GET cbd_kenpom_ratings ### Description Pulls year-end KenPom ratings and adjusted efficiencies from 2001-Present. ### Method Function call (R) ### Parameters #### Arguments - **...** (optional) - Filter criteria including `team`, `conf`, `year`, or any other data column. If no arguments are passed, the complete data set is returned. ### Request Example ```r cbd_kenpom_ratings(year = 2023) ``` ``` -------------------------------- ### GET cbd_torvik_ncaa_sheets Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_ncaa_sheets.html Retrieves a tibble containing NCAA tournament committee seeding metrics, including resume and quality rankings, for a specified year. ```APIDOC ## GET cbd_torvik_ncaa_sheets ### Description Returns a tibble with quality and resume metrics used by the NCAA seeding committee. Data is available from 2019 to the present. ### Parameters #### Query Parameters - **year** (double) - Optional - The season year (YYYY). Defaults to the current season. ### Response #### Success Response (200) - **team** (character) - Team name - **seed** (double) - Tournament seed - **net** (double) - NCAA Net Ranking - **kpi_resume** (double) - KPI resume metric - **sor_resume** (double) - Strength of record resume metric - **avg_resume** (double) - Average of resume rankings - **bpi_quality** (double) - BPI quality metric - **kp_quality** (double) - KenPom quality metric - **sag_quality** (double) - Sagarin quality metric - **avg_quality** (double) - Average of quality rankings - **q1a** (character) - Q1-A record - **q1** (character) - Q1 record - **q2** (character) - Q2 record - **q1_2** (character) - Combined Q1 + Q2 record - **q3** (character) - Q3 record - **q4** (character) - Q4 record ### Request Example ```r cbd_torvik_ncaa_sheets(year=2019) ``` ``` -------------------------------- ### Get Barttorvik Team Stat Splits Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_split.html Pulls final team season averages by split from 2008-Present. You can specify a split type and optional filters. ```APIDOC ## GET /api/barttorvik/team_splits ### Description Retrieves final team season averages by split from 2008-Present. Allows for splitting data by game result, location, game type, or month, and filtering by year, team, conference, or other data columns. ### Method GET ### Endpoint /api/barttorvik/team_splits ### Parameters #### Query Parameters - **split** (string) - Required - The category to split the data by. Options: 'game_result', 'location', 'game_type', 'month'. Defaults to 'game_result'. - **year** (integer) - Optional - Filters data for a specific year. - **team** (string) - Optional - Filters data for a specific team. - **conf** (string) - Optional - Filters data for a specific conference. - **location** (string) - Optional - Filters data by location (e.g., 'Home', 'Away', 'Neutral'). - **game_type** (string) - Optional - Filters data by game type (e.g., 'Conf', 'Non-Conf'). - **month** (integer) - Optional - Filters data for a specific month (1-12). ### Request Example ```json { "split": "month", "year": 2023 } ``` ### Response #### Success Response (200) - **data** (array) - An array of objects, where each object contains team statistics for the specified split and filters. - **year** (integer) - The year of the statistics. - **team** (string) - The name of the team. - **conf** (string) - The conference the team belongs to. - **split_category** (string) - The category used for splitting the data (e.g., 'month', 'location'). - **split_value** (string/integer) - The specific value within the split category (e.g., '11' for November, 'Home'). - **avg_stats** (object) - An object containing average statistics (e.g., points scored, rebounds, assists). #### Response Example ```json { "data": [ { "year": 2023, "team": "Team A", "conf": "Conf X", "split_category": "month", "split_value": "11", "avg_stats": { "pts": 75.5, "reb": 35.2, "ast": 15.1 } }, { "year": 2023, "team": "Team A", "conf": "Conf X", "split_category": "month", "split_value": "12", "avg_stats": { "pts": 78.0, "reb": 36.0, "ast": 16.0 } } ] } ``` ``` -------------------------------- ### Get Four Factor Team Splits Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_factors.html Use this function to retrieve team-wide four factor data. Specify parameters like year, venue, game type, and opponent ranking to filter the results. The `no_bias` argument can be set to TRUE to view ratings without preseason bias. ```R cbd_torvik_team_factors( year = NULL, venue = "all", game_type = "all", quad = "4", top = 0, start = NULL, end = NULL, no_bias = FALSE ) ``` ```R try(cbd_torvik_team_factors(2023, start = '20230101')) ``` -------------------------------- ### GET T-Rank Game Predictions Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_prediction.html Retrieves projected game statistics for a specific matchup between two teams at a given location and date. ```APIDOC ## GET cbd_torvik_game_prediction ### Description Returns projected tempo, points per possession, total points scored, and win percentage for any matchup at any location back to the 2014-15 season using Barttorvik's formulas and data. ### Parameters #### Arguments - **team** (string) - Required - Team 1 in matchup (primary team) - **opp** (string) - Required - Team 2 in matchup (opponent) - **date** (string) - Optional - Date of game in YYYYMMDD format (defaults to current day) - **location** (string) - Optional - Location of game relative to team ('H', 'A', or 'N'), defaults to 'H' (home) ### Request Example ```r cbd_torvik_game_prediction(team = 'Duke', opp = 'Charlotte', date = '20221110') ``` ### Response - **Returns** (tibble) - A tibble containing game predictions including tempo, points per possession, total points, and win percentage. ``` -------------------------------- ### Get NCAA Tournament Results by Conference Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_ncaa_results.html Fetches NCAA tournament results for a specified range of years, split by conference. Requires the `cbbdata` package. ```R try(cbd_torvik_ncaa_results(min_year=2010, max_year=2015, type='conf')) ``` -------------------------------- ### Predict Game Outcomes with cbd_torvik_game_prediction Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_prediction.html Use this function to get game predictions for any matchup. Specify teams, date, and location. Note that the first-time login may require an R session restart. ```R cbd_torvik_game_prediction('Duke', 'Charlotte', '20221110') ``` -------------------------------- ### Get Barttorvik Team Factors (No Bias) Source: https://cbbdata.aweatherman.com/index.html Retrieves Barttorvik team factors for a specified year, with an option to exclude bias. Displays the top 10 teams based on 'barthag', 'adj_o', and 'adj_d' metrics. ```R cbbdata::cbd_torvik_team_factors(year = 2024, no_bias = TRUE) %>% dplyr::slice(1:10) %>% dplyr::select(team, barthag, adj_o, adj_d) #> # A tibble: 10 × 4 #> team barthag adj_o adj_d #> #> 1 Houston 0.978 119. 85.7 #> 2 Connecticut 0.977 127. 92.0 #> 3 Purdue 0.967 126. 93.8 #> 4 Auburn 0.953 120. 92.6 #> 5 Arizona 0.952 121. 93.0 #> 6 Iowa St. 0.950 114. 88.0 #> 7 Tennessee 0.945 116. 90.5 #> 8 North Carolina 0.937 119. 93.9 #> 9 Duke 0.935 121. 95.7 #> 10 Marquette 0.928 118. 94.4 ``` -------------------------------- ### Get Committee Tournament Sheets Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_ncaa_sheets.html Use this function to retrieve a tibble containing quality and resume metrics similar to those used by the NCAA seeding committee. Data is available from 2019 to the present. ```R cbd_torvik_ncaa_sheets(year) ``` -------------------------------- ### Authenticate with CBBData API Source: https://cbbdata.aweatherman.com/reference/cbd_login.html Use this function to establish an API session. If arguments are omitted, the function provides an interactive prompt to configure persistent credentials. ```R cbd_login(username = Sys.getenv("CBD_USER"), password = Sys.getenv("CBD_PW")) ``` -------------------------------- ### Persistent CBBData Log-In Source: https://cbbdata.aweatherman.com/index.html Sets up a persistent log-in for the CBBData API by storing username and password in the .Renviron file. This method requires restarting your R session. ```R # persistent log-in cbbdata::cbd_login() ``` -------------------------------- ### GET cbd_torvik_ncaa_results Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_ncaa_results.html Retrieves a tibble of NCAA tournament results filtered by year range and aggregation type. ```APIDOC ## GET cbd_torvik_ncaa_results ### Description Returns a tibble with raw and adjusted NCAA tournament results by team, coach, conference, or seed. Data runs from 2000-present. ### Parameters #### Query Parameters - **min_year** (integer) - Required - Minimum year to pull (YYYY) - **max_year** (integer) - Required - Maximum year to pull (YYYY) - **type** (string) - Optional - Data split value, defaults to 'team'. Options: 'team', 'coach', 'conf', 'seed'. ### Request Example ```r cbd_torvik_ncaa_results(min_year=2010, max_year=2015, type='conf') ``` ### Response #### Success Response (200) - **rk** (double) - Rank - **conf** (string) - Conference name - **pake** (double) - Wins above or below KenPom expectation - **pase** (double) - Performance against seed expectation - **wins** (double) - Total tournament wins - **loss** (double) - Total tournament losses - **w_percent** (double) - Win percentage - **r64, r32, s16, e8, f4, f2, champ** (double) - Tournament round progression counts ``` -------------------------------- ### Register for cbbdata API Account Source: https://cbbdata.aweatherman.com/articles/release.html Create a new account for the cbbdata API by providing a username, email, and password. Confirm the password to complete registration. ```R cbbdata::cbd_create_account(username, email, password, confirm_password) ``` -------------------------------- ### POST /cbd_login Source: https://cbbdata.aweatherman.com/reference/cbd_login.html Authenticates a user with the CBBData API and retrieves an API key for the current session. ```APIDOC ## POST /cbd_login ### Description Retrieves a user's CBBData API key. If no arguments are provided, the function guides the user through creating a persistent log-in via the .Renviron file. ### Method POST ### Parameters #### Request Body - **username** (string) - Optional - Username for authentication. Defaults to Sys.getenv("CBD_USER"). - **password** (string) - Optional - Password for authentication. Defaults to Sys.getenv("CBD_PW"). ### Request Example { "username": "your_username", "password": "your_password" } ``` -------------------------------- ### Usage of cbd_torvik_similar_resumes Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_similar_resumes.html Defines the function signature and available parameters for calculating team resume similarity. ```R cbd_torvik_similar_resumes( team, year, conf_limit = "All", at_large_only = FALSE, current_resume = FALSE, net_weight = 1, resume_weight = 1, wab_weight = 1, elo_weight = 1, power_weight = 1 ) ``` -------------------------------- ### Register for a CBBData Account Source: https://cbbdata.aweatherman.com/reference/cbd_create_account.html This function allows a user to create a CBBData API account to retrieve an API key. ```APIDOC ## Register for a CBBData Account ### Description Allows a user to create a CBBData API account to retrieve an API key. ### Method POST ### Endpoint /api/register ### Parameters #### Request Body - **username** (string) - Required - The desired username for the account. - **email** (string) - Required - The email address for the account. - **password** (string) - Required - The password for the account. - **confirm_password** (string) - Required - Re-enter the password to confirm. ### Request Example ```json { "username": "newuser", "email": "user@example.com", "password": "securepassword123", "confirm_password": "securepassword123" } ``` ### Response #### Success Response (201 Created) - **message** (string) - A success message indicating account creation. - **api_key** (string) - The newly generated API key for the user. #### Response Example ```json { "message": "Account created successfully. Your API key is:", "api_key": "your_generated_api_key" } ``` #### Error Response (400 Bad Request) - **error** (string) - A message describing the error (e.g., passwords do not match, username taken). #### Error Response Example ```json { "error": "Passwords do not match." } ``` ``` -------------------------------- ### Retrieve Tournament Resume Data Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_current_resume.html Executes the function to fetch current resume data. Note that first-time usage requires authentication and an R session restart. ```R cbd_torvik_current_resume() ``` ```R try(cbd_torvik_current_resume()) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Usage of cbd_torvik_player_split Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_player_split.html Defines the function signature for retrieving player splits. ```R cbd_torvik_player_split(split, ...) ``` -------------------------------- ### Retrieve All Metrics Source: https://cbbdata.aweatherman.com/reference/cbd_all_metrics.html Fetches various college basketball metrics into a single tibble. Requires an active session and authentication. ```R cbd_all_metrics(...) ``` ```R try(cbd_all_metrics()) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Similar Team Resumes Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_similar_resumes.html Find which teams share similar pre-tournament resumes (2008-present). ```APIDOC ## Similar Team Resumes ### Description Find which teams share similar pre-tournament resumes (2008-present). ### Method GET ### Endpoint /websites/cbbdata_aweatherman/similar_resumes ### Parameters #### Query Parameters - **team** (string) - Required - The name of the team to compare. - **year** (integer) - Required - The year for which to find similar resumes. - **conf_limit** (string) - Optional - Filter by conference or conference groups (accepts any conference abbreviation, 'NCAA', 'Himajor', or 'mid'). Defaults to 'All'. - **at_large_only** (boolean) - Optional - Filter on at-large teams only. Defaults to FALSE. - **current_resume** (boolean) - Optional - Filter on whether to use projected resume or current resume. Defaults to FALSE (projected resume). - **net_weight** (numeric) - Optional - Weight to assign NET ranking. Defaults to 1. - **resume_weight** (numeric) - Optional - Weight to assign resume. Defaults to 1. - **wab_weight** (numeric) - Optional - Weight to assign 'Wins Above Bubble' (WAB). Defaults to 1. - **elo_weight** (numeric) - Optional - Weight to assign ELO. Defaults to 1. - **power_weight** (numeric) - Optional - Weight to assign power rating. Defaults to 1. ### Response #### Success Response (200) - **data** (tibble) - A tibble containing pre-tournament resumes of similar teams. ### Request Example ```r # Example usage: cbd_torvik_similar_resumes('Duke', 2023) ``` ### Response Example ```r # Example response structure (actual data will vary): # A tibble with columns like team, year, resume_score, etc. ``` ``` -------------------------------- ### Create CBBData Account Source: https://cbbdata.aweatherman.com/reference/cbd_create_account.html Use this function to create a new CBBData API account. Requires username, email, and password confirmation. ```R cbd_create_account(username, email, password, confirm_password) ``` -------------------------------- ### Usage of cbd_torvik_team_schedule Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_schedule.html Basic function call syntax for retrieving team schedules. ```R cbd_torvik_team_schedule(...) ``` -------------------------------- ### Retrieve CBBData Team Information Source: https://cbbdata.aweatherman.com/reference/cbd_teams.html Fetches the team matching dictionary along with associated logos, colors, and wordmarks. Requires an active session and authentication. ```R cbd_teams(...) ``` ```R try(cbd_teams()) #> We notice that this is your first time logging into `cbbdata`. #> This process will require restarting your R session. #> Do you want to continue [Y/N] #> #> Invalid username or password! #> Error in cbbdata::cbd_login() : object 'resp' not found ``` -------------------------------- ### Get Four Factor Team History Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_team_history.html Retrieves a tibble containing four-factor team history. Use this function to access detailed historical team performance metrics. ```R cbd_torvik_team_history(team = 'Duke') ``` -------------------------------- ### Authorize Account with KenPom Source: https://cbbdata.aweatherman.com/reference/cbd_kenpom_authorization.html This endpoint allows you to authorize your account with KenPom to access protected data. Ensure your CBBData account email matches your KenPom email. ```APIDOC ## POST /api/kenpom/authorize ### Description Grants a user access to KenPom endpoints if they have an active KenPom account. Your CBBData account email must match your KenPom email. You will be asked to reauthorize on your KenPom account expiration date. ### Method POST ### Endpoint /api/kenpom/authorize ### Parameters #### Request Body - **password** (string) - Required - Your KenPom password, NOT your CBBData password. ### Request Example { "password": "your_kenpom_password" } ### Response #### Success Response (200) - **message** (string) - Confirmation message of successful authorization. #### Response Example { "message": "Successfully authorized with KenPom." } ``` -------------------------------- ### Authorize KenPom Account Source: https://cbbdata.aweatherman.com/index.html Authenticate your KenPom subscription by passing your password to the authorization function. ```R # persistent log-in cbbdata::cbd_kenpom_authorization(password = 'xxx') ``` -------------------------------- ### Simulate Team Season Outcomes Source: https://cbbdata.aweatherman.com/index.html Run season simulations for a team based on current performance data. ```R # no date -> defaults to today cbbdata::cbd_torvik_season_simulation('Duke', 2024) %>% ggplot2::ggplot(aes(wins, probability)) + ggplot2::geom_col() + ggplot2::scale_y_continuous(labels = scales::label_percent()) ``` -------------------------------- ### Register for a CBBData API Account Source: https://cbbdata.aweatherman.com/index.html Registers a new account for the CBBData API. Ensure your CBBData account email matches your KenPom account email if you need to access KenPom data. ```R # to register cbbdata::cbd_create_account(username = 'xxx', email = 'xxx', password = 'xxx', confirm_password = 'xxx') ``` -------------------------------- ### Authorize KenPom Account Source: https://cbbdata.aweatherman.com/reference/cbd_kenpom_authorization.html Use this function to grant access to KenPom endpoints. Ensure your CBBData email matches your KenPom email and provide your KenPom password. ```R cbd_kenpom_authorization(password) ``` -------------------------------- ### Usage of cbd_torvik_game_stats Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_stats.html Call this function to retrieve game statistics. Pass no arguments to load the full dataset or provide filters to narrow the results. ```R cbd_torvik_game_stats(...) ``` -------------------------------- ### Player Data API Source: https://cbbdata.aweatherman.com/reference/index.html Functions for retrieving player-level data, including game logs, season averages, and stat splits. ```APIDOC ## Player Data API ### Description Functions for grabbing player-level data. ### Endpoints #### `cbd_torvik_player_game()` **Description**: Barttorvik Player Game Logs #### `cbd_torvik_player_season()` **Description**: Barttorvik Player Season Averages #### `cbd_torvik_player_split()` **Description**: Barttorvik Player Stat Splits ``` -------------------------------- ### Retrieve Top Teams by Q1 Wins Source: https://cbbdata.aweatherman.com/index.html Fetch current resume data and identify teams with the highest number of Quadrant 1 wins. ```R cbbdata::cbd_torvik_current_resume() %>% dplyr::mutate(q1_wins = readr::parse_number(quad1)) %>% dplyr::slice_max(q1_wins, n = 5) %>% dplyr::select(team, conf, q1_wins, net) #> # A tibble: 5 × 4 #> team conf q1_wins net #> #> 1 Connecticut BE 19 12 #> 2 Purdue B10 18 16 #> 3 Houston B12 17 1 #> 4 Tennessee SEC 14 5 #> 5 Texas A&M SEC 13 21 ``` -------------------------------- ### Usage of cbd_torvik_game_box Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_game_box.html Call this function to retrieve game box statistics. Pass no arguments to load the complete dataset or filter by specific parameters. ```R cbd_torvik_game_box(...) ``` -------------------------------- ### Generate Team Matching Dictionary Source: https://cbbdata.aweatherman.com/reference/cbd_match_teams.html A utility function that returns a named vector to be used as a matching dictionary. ```APIDOC ## Generate a team matching dictionary ### Description A utility function that returns a named vector to be used as a matching dictionary. ### Method NA ### Endpoint NA ### Usage ```R cbd_match_teams() ``` ### Examples ```R try(cbd_match_teams()['Duke Blue Devils']) ``` -------------------------------- ### Generate Team Matching Dictionary Source: https://cbbdata.aweatherman.com/reference/cbd_match_teams.html Use this utility function to generate a named vector for team matching. It is often used after attempting to log in. ```r cbd_match_teams() ``` ```r try(cbd_match_teams()['Duke Blue Devils']) ``` -------------------------------- ### Per-Session CBBData Log-In Source: https://cbbdata.aweatherman.com/index.html Logs into the CBBData API for the current R session. A log-in is required each session if not using persistent log-in. ```R # per-session log-in cbbdata::cbd_login(username = 'xxx', password = 'xxx') ``` -------------------------------- ### Usage of cbd_torvik_player_game Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_player_game.html Executes the function to retrieve player game logs. Arguments are optional and can be used to filter by year, team, or player. ```R cbd_torvik_player_game(...) ``` -------------------------------- ### Retrieve NET Rankings Source: https://cbbdata.aweatherman.com/reference/cbd_net_archive.html Access daily NET rankings. Requires an active cbbdata session and authentication. ```R cbd_net_archive(...) ``` ```R try(cbd_net_archive(team = "Duke")) ``` -------------------------------- ### Daily NET Rankings Source: https://cbbdata.aweatherman.com/reference/cbd_net_archive.html Pulls daily NET rankings along with other metrics from the 2023-24 season. ```APIDOC ## GET /api/net_rankings ### Description Pulls daily NET rankings along with other metrics from the 2023-24 season. ### Method GET ### Endpoint /api/net_rankings ### Parameters #### Query Parameters - **team** (string) - Optional - Filter by team name. - **conf** (string) - Optional - Filter by conference. - **year** (integer) - Optional - Filter by year. ### Request Example ```json { "team": "Duke", "year": 2024 } ``` ### Response #### Success Response (200) - **rankings** (array) - An array of daily NET rankings. - **team** (string) - The name of the team. - **net_rank** (integer) - The NET ranking of the team. - **year** (integer) - The year the ranking is from. #### Response Example ```json { "rankings": [ { "team": "Duke", "net_rank": 10, "year": 2024 } ] } ``` ``` -------------------------------- ### Game Data API Source: https://cbbdata.aweatherman.com/reference/index.html Functions for retrieving game-level data, including box scores, four factors, and schedules. ```APIDOC ## Game Data API ### Description Functions for grabbing game-level data. ### Endpoints #### `cbd_torvik_game_box()` **Description**: Barttorvik Game Box Stats #### `cbd_torvik_game_factors()` **Description**: Barttorvik Game Four Factors #### `cbd_torvik_game_stats()` **Description**: Barttorvik Full Game Stats #### `cbd_torvik_season_schedule()` **Description**: Barttorvik Season Schedules #### `cbd_torvik_team_schedule()` **Description**: Barttorvik Team Season Schedules #### `cbd_add_net_quad()` **Description**: Add Net Rankings and Quadrants to Data ``` -------------------------------- ### Function Usage: cbd_torvik_conf_factors Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_conf_factors.html Defines the parameters for retrieving conference-wide four factor data. ```R cbd_torvik_conf_factors( year, venue = "all", game_type = "all", quad = "all", top = 0, start = NULL, end = NULL ) ``` -------------------------------- ### T-Rank Season Simulation Source: https://cbbdata.aweatherman.com/reference/cbd_torvik_season_simulation.html Run a simulation to determine how many games a team is projected to win using their schedule at any given date in the season. ```APIDOC ## T-Rank Season Simulation ### Description Run a simulation to determine how many games a team is projected to win using their schedule at any given date in the season. ### Method Not applicable (R function) ### Endpoint Not applicable (R function) ### Parameters #### Arguments - **team** (string) - Required - Team to predict with. - **year** (integer) - Required - Year to run prediction on. - **simulations** (integer) - Optional - An integer representing how many sims. to run (defaults to 10,000). - **date** (string) - Optional - Date of game and must be a consecutive string in YYYYMMDD format (defaults to current day). - **include_postseason** (boolean) - Optional - A boolean representing whether conference tournament and other postseason games should be included in the simulation (defaults to FALSE). ### Request Example ```R cbd_torvik_season_simulation('Duke', 2023, date = '20230101') ``` ### Response #### Value Returns a tibble with simulation results. ``` -------------------------------- ### Visualize Team Offensive Performance Source: https://cbbdata.aweatherman.com/index.html Retrieve game factors for a specific team and visualize offensive performance trends over the season. ```R cbbdata::cbd_torvik_game_factors(year = 2024, team = 'Duke') %>% ggplot2::ggplot(aes(date, adj_o)) + ggplot2::geom_line() + ggplot2::geom_point(aes(color = result), size = 3) + ggplot2::scale_color_manual(values = c('darkred', 'darkgreen'), guide = NULL) + ggplot2::theme_minimal() ``` -------------------------------- ### Tournament Results and Resumes API Source: https://cbbdata.aweatherman.com/reference/index.html Functions for retrieving historical tournament performance and team sheets. ```APIDOC ## Tournament Results + Resumes API ### Description Functions for grabbing historical tournament performance and team sheets. ### Endpoints #### `cbd_torvik_current_resume()` **Description**: Get Current Tournament Resumes #### `cbd_torvik_ncaa_results()` **Description**: Get NCAA Tournament Results #### `cbd_torvik_ncaa_sheets()` **Description**: Get Committee Tournament Sheets #### `cbd_torvik_resume_database()` **Description**: Get Selection Sunday Resumes #### `cbd_torvik_similar_resumes()` **Description**: Similar Team Resumes ```