### Example: load_nwsl_pbp(2021) Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_pbp.html Example call to load_nwsl_pbp for the 2021 season. The example is wrapped in try() and donttest{} to avoid errors. The output shows a warning about a 404 Not Found URL and a tibble with 0 rows. ```r # \donttest{ try(load_nwsl_pbp(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/pbp/rds/play_by_play_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example: Get schedule from date 2020-08-29 Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_scoreboard.html Example call to espn_nwsl_scoreboard with a date string. Wrapped in try() and donttest to handle errors. If no data is available, it prints an error message. ```R # Get schedule from date 2020-08-29 # \donttest{ try(espn_nwsl_scoreboard (season = "20200829")) #> 2026-10-12 11:55:38: Invalid arguments or no scoreboard data available! # } ``` -------------------------------- ### Example: load_mls_schedule(2021) Source: https://usfootballr.sportsdataverse.org/reference/load_mls_schedule.html Example usage of load_mls_schedule with the 2021 season. The example is wrapped in \donttest{} and try() to handle potential errors. The output shows a warning about a 404 Not Found and a tibble with 0 rows. ```r # \donttest{ try(load_mls_schedule(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/mls/schedules/rds/mls_schedule_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example: Get schedule from date 2020-08-29 Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_scoreboard.html Example call to espn_mls_scoreboard with season '20200829'. Wrapped in try() and donttest{} to avoid errors during testing. If invalid arguments or no data, prints 'Invalid arguments or no scoreboard data available!'. ```r # Get schedule from date 2020-08-29 # \donttest{ try(espn_mls_scoreboard (season = "20200829")) #> 2026-10-12 11:55:36: Invalid arguments or no scoreboard data available! # } ``` -------------------------------- ### load_mls_player_box example Source: https://usfootballr.sportsdataverse.org/reference/load_mls_player_box.html Example call to load_mls_player_box for the 2021 season. The example is wrapped in try() and \donttest{} to avoid issues during testing. The output shows warnings for a 404 error and an empty tibble, indicating the data file is not available. ```R # \donttest{ try(load_mls_player_box(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/mls/player_box/rds/player_box_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example: espn_nwsl_standings(year = 2021) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_standings.html Example call wrapped in try() and \donttest{}. Retrieves 2021 NWSL standings and prints a tibble with team details, points, and records. ```r # \donttest{ try(espn_nwsl_standings(year = 2021)) #> team_id team gamesplayed losses pointdifferential points #> 1 15362 Portland Thorns FC 24 6 16 44 #> 2 15363 Seattle Reign FC 24 8 13 42 #> 3 15365 Washington Spirit 24 7 3 39 #> 4 15360 Chicago Stars FC 24 8 0 38 #> 5 15364 Gotham FC 24 5 8 35 #> 6 15366 North Carolina Courage 24 9 5 33 #> 7 17346 Houston Dash 24 10 0 32 #> 8 18206 Orlando Pride 24 10 -5 28 #> 9 20905 Racing Louisville FC 24 12 -19 22 #> 10 20907 Kansas City Current 24 14 -21 16 #> pointsagainst pointsfor ties wins advanced deductions ppg rank rankchange #> 1 17 33 5 13 0 0 0 1 0 #> 2 24 37 3 13 0 0 0 2 0 #> 3 26 29 6 11 0 0 0 3 0 #> 4 28 28 5 11 0 0 0 4 0 #> 5 21 29 11 8 0 0 0 5 0 #> 6 23 28 6 9 0 0 0 6 0 #> 7 31 31 5 9 0 0 0 7 0 #> 8 32 27 7 7 0 0 0 8 0 #> 9 40 21 7 5 0 0 0 9 0 #> 10 36 15 7 3 0 0 0 10 0 #> total #> 1 13-5-6 #> 2 13-3-8 #> 3 11-6-7 #> 4 11-5-8 #> 5 8-11-5 #> 6 9-6-9 #> 7 9-5-10 #> 8 7-7-10 #> 9 5-7-12 #> 10 3-7-14 # } ``` -------------------------------- ### Example: load_mls_pbp(2021) with output Source: https://usfootballr.sportsdataverse.org/reference/load_mls_pbp.html This example calls load_mls_pbp() for the 2021 season. It is wrapped in try() and donttest{}. The output shows warnings about a 404 Not Found error and a failed readRDS, followed by an empty tibble (0 rows, 0 columns). ```R # \donttest{ try(load_mls_pbp(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/mls/pbp/rds/play_by_play_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example call with try() and output Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_game_all.html Example usage wrapped in try() to handle errors. The output shows invalid arguments or no data available for game_id 598135, and an error indicating 'plays_df' not found. ```r # \donttest{ try(espn_mls_game_all(game_id = 598135)) #> 2026-10-12 11:55:36: Invalid arguments or no play-by-play data for 598135 available! #> 2026-10-12 11:55:36: Invalid arguments or no team box score data for 598135 available! #> Error in espn_mls_game_all(game_id = 598135) : #> object 'plays_df' not found # } ``` -------------------------------- ### Example: load_mls_team_box(2021) Source: https://usfootballr.sportsdataverse.org/reference/load_mls_team_box.html Example usage of load_mls_team_box with the 2021 season. The example is wrapped in \donttest{} and includes a try() call. The output shows warnings about a 404 error and a failed readRDS, resulting in an empty tibble. ```r # \donttest{ try(load_mls_team_box(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/mls/team_box/rds/team_box_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example: espn_nwsl_teams() with output Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_teams.html Example usage wrapped in try() and donttest. The output shows a tibble with 16 rows and 10 columns including team_id, team, mascot, display_name, short_name, abbreviation, color, alternate_color, logo, and logo_dark. ```r # \donttest{ try(espn_nwsl_teams()) #> # A tibble: 16 × 10 #> team_id team mascot display_name short_name abbreviation color #> #> 1 21422 Angel City FC Angel… Angel City … Angel City LA 2021… #> 2 22187 Bay FC Bay FC Bay FC Bay BAY ff50… #> 3 131562 Boston Legacy FC Bosto… Boston Lega… Boston BOS 00FF… #> 4 15360 Chicago Stars FC Chica… Chicago Sta… Chicago CHI c710… #> 5 131563 Denver Summit FC Denve… Denver Summ… Denver DEN 2060… #> 6 15364 Gotham FC Gotha… Gotham FC Gotham GFC a9f1… #> 7 17346 Houston Dash Houst… Houston Dash Houston HOU ff69… #> 8 20907 Kansas City Current Kansa… Kansas City… Kansas Ci… KC cf33… #> 9 15366 North Carolina Cou… North… North Carol… North Car… NC ab00… #> 10 18206 Orlando Pride Orlan… Orlando Pri… Orlando ORL c5b5… #> 11 15362 Portland Thorns FC Portl… Portland Th… Portland POR 0000… #> 12 20905 Racing Louisville … Racin… Racing Loui… Louisville LOU c5b5… #> 13 21423 San Diego Wave FC San D… San Diego W… San Diego SD 032e… #> 14 15363 Seattle Reign FC Seatt… Seattle Rei… Seattle SEA 2924… #> 15 19141 Utah Royals Utah … Utah Royals Utah UTA ae12… #> 16 15365 Washington Spirit Washi… Washington … Washington WAS 0000… #> # ℹ 3 more variables: alternate_color , logo , logo_dark # } ``` -------------------------------- ### Example: load_nwsl_schedule(2021) Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_schedule.html Example call to load the 2021 NWSL schedule. The try() wrapper suppresses errors. The output shows warnings about a 404 Not Found error and a failed readRDS, resulting in an empty tibble (0 × 0). ```R # \donttest{ try(load_nwsl_schedule(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/schedules/rds/nwsl_schedule_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Install usfootballR from GitHub using pacman Source: https://usfootballr.sportsdataverse.org/index.html Install the released version of usfootballR from GitHub using the pacman package. This code checks for pacman and installs it if necessary, then loads the current version from the sportsdataverse GitHub repository with dependencies and updates. ```R if (!requireNamespace('pacman', quietly = TRUE)){ install.packages('pacman') } pacman::p_load_current_gh("sportsdataverse/usfootballR", dependencies = TRUE, update = TRUE) ``` -------------------------------- ### Call espn_mls_teams() to get MLS team data Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_teams.html Returns a tibble with 30 rows and 10 columns including team_id, team, mascot, display_name, short_name, abbreviation, color, alternate_color, logo, and logo_dark. The example is wrapped in try() and \donttest{} to avoid CRAN test failures. ```R espn_mls_teams() ``` ```R # \donttest{ try(espn_mls_teams()) #> # A tibble: 30 × 10 #> team_id team mascot display_name short_name abbreviation color #> #> 1 18418 Atlanta United FC Atlanta… Atlanta Uni… Atlanta ATL 9d22… #> 2 20906 Austin FC Austin … Austin FC Austin ATX 00b1… #> 3 9720 CF Montréal CF Mont… CF Montréal CF Montré… MTL 003d… #> 4 21300 Charlotte FC Charlot… Charlotte FC Charlotte CLT 0085… #> 5 182 Chicago Fire FC Chicago… Chicago Fir… Chicago CHI 7ccd… #> 6 184 Colorado Rapids Colorad… Colorado Ra… Colorado COL 8a24… #> 7 183 Columbus Crew Columbu… Columbus Cr… Columbus CLB 0000… #> 8 193 D.C. United D.C. Un… D.C. United D.C. Unit… DC 0000… #> 9 18267 FC Cincinnati FC Cinc… FC Cincinna… Cincinnati CIN 0030… #> 10 185 FC Dallas FC Dall… FC Dallas Dallas DAL c609… #> # ℹ 20 more rows #> # ℹ 3 more variables: alternate_color , logo , logo_dark # } ``` -------------------------------- ### Example call with try() and expected output Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_team_box.html Example usage of espn_mls_team_box with game_id = 598135, wrapped in try() and \donttest{}. The output shows an error message when no team box score data is available. ```R # \donttest{ try(espn_mls_team_box(game_id = 598135)) #> 2026-10-12 11:55:37: Invalid arguments or no team box score data for 598135 available! #> Error in espn_mls_team_box(game_id = 598135) : #> object 'team_box_score' not found # } ``` -------------------------------- ### Example: espn_nwsl_team_box with game_id 601833 Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_team_box.html Example call wrapped in try() to handle errors. The output shows an error message when no team box score data is available for the given game_id. ```r # \donttest{ try(espn_nwsl_team_box(game_id = 601833)) #> 2026-10-12 11:55:38: Invalid arguments or no team box score data for 601833 available! #> Error in espn_nwsl_team_box(game_id = 601833) : #> object 'team_box_score' not found # } ``` -------------------------------- ### Example: espn_nwsl_game_all with game_id = 601833 Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_game_all.html Example call to espn_nwsl_game_all with game_id = 601833, wrapped in try() and donttest. The output shows an error message when the request fails due to invalid JSON. ```R # \donttest{ try(espn_nwsl_game_all(game_id = 601833)) #> Error : lexical error: invalid char in json text. #> (right here) ------^ #> # } ``` -------------------------------- ### Example: espn_mls_standings(year = 2021) Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_standings.html Example call wrapped in try() to handle errors. When no standings data is available, it prints 'Invalid arguments or no standings data available!' and throws an error 'object 'standings' not found'. ```r # \donttest{ try(espn_mls_standings(year = 2021)) #> 2026-10-12 11:55:37: Invalid arguments or no standings data available! #> Error in espn_mls_standings(year = 2021) : object 'standings' not found # } ``` -------------------------------- ### Example: load_nwsl_team_box(2021) with output Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_team_box.html Example call for the 2021 season. The output shows warnings about a 404 Not Found URL and a failed readRDS, resulting in an empty tibble (0 × 0). This is wrapped in \donttest{} and try() to avoid errors during testing. ```r # \donttest{ try(load_nwsl_team_box(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/team_box/rds/team_box_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example: espn_nwsl_pbp with game_id 601833 Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_pbp.html Example call wrapped in try() and donttest. When the game ID is invalid, the function returns an error: 'lexical error: invalid char in json text.' ```R # \donttest{ try(espn_nwsl_pbp(game_id = 601833)) #> Error : lexical error: invalid char in json text. #> (right here) ------^ #> # } ``` -------------------------------- ### Example: Load 2021 NWSL Player Box Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_player_box.html Attempts to load the 2021 NWSL player box data. The example is wrapped in \donttest{} and includes try() to handle errors. Expected output shows warnings about a 404 Not Found and a resulting empty tibble. ```r # \donttest{ try(load_nwsl_player_box(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/player_box/rds/player_box_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` -------------------------------- ### Example: espn_mls_pbp with game_id 598135 Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_pbp.html Example call to espn_mls_pbp with game_id 598135, wrapped in try() and \donttest{}. The output shows an error about invalid JSON text, likely due to a non-JSON response. ```r # \donttest{ try(espn_mls_pbp(game_id = 598135)) #> Error : lexical error: invalid char in json text. #> (right here) ------^ #> # } ``` -------------------------------- ### espn_nwsl_pbp() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's NWSL play-by-play data. ```APIDOC ## espn_nwsl_pbp() ### Description Get ESPN's NWSL play by play data. ### Usage espn_nwsl_pbp() ### Source ESPN's API ``` -------------------------------- ### espn_mls_pbp() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's MLS play-by-play data. ```APIDOC ## espn_mls_pbp() ### Description Get ESPN's MLS play by play data. ### Usage espn_mls_pbp() ### Source ESPN's API ``` -------------------------------- ### espn_nwsl_standings() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN NWSL standings. ```APIDOC ## espn_nwsl_standings() ### Description Get ESPN NWSL Standings. ### Usage espn_nwsl_standings() ### Source ESPN's API ``` -------------------------------- ### espn_nwsl_game_all() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's NWSL game data including play-by-play and team data. ```APIDOC ## espn_nwsl_game_all() ### Description Get ESPN's NWSL game data (play-by-play, team). ### Usage espn_nwsl_game_all() ### Source ESPN's API ``` -------------------------------- ### espn_nwsl_team_box() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's NWSL team box data. ```APIDOC ## espn_nwsl_team_box() ### Description Get ESPN's NWSL team box data. ### Usage espn_nwsl_team_box() ### Source ESPN's API ``` -------------------------------- ### espn_mls_game_all() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's MLS game data including play-by-play and team data. ```APIDOC ## espn_mls_game_all() ### Description Get ESPN's MLS game data (play-by-play, team). ### Usage espn_mls_game_all() ### Source ESPN's API ``` -------------------------------- ### espn_mls_standings() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN MLS standings. ```APIDOC ## espn_mls_standings() ### Description Get ESPN MLS Standings. ### Usage espn_mls_standings() ### Source ESPN's API ``` -------------------------------- ### load_nwsl_pbp() Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_pbp.html Loads multiple seasons of NWSL play-by-play data from the data repository into memory or writes it into a database using forwarded arguments. ```APIDOC ## load_nwsl_pbp() ### Description Loads multiple seasons of NWSL play-by-play data from the data repository into memory or writes it into a database using forwarded arguments. ### Usage ```r load_nwsl_pbp( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` ### Arguments - **seasons** (vector of integers) - A vector of 4-digit years associated with given NWSL seasons. (Min: 2002) - **...** (additional arguments) - Additional arguments passed to an underlying function that writes the season data into a database (used by `update_nwsl_db()`). - **dbConnection** (DBIConnection) - A `DBIConnection` object, as returned by `DBI::dbConnect()`. - **tablename** (character) - The name of the play by play data table within the database. ### Value A dataframe. ### Examples ```r # \donttest{ try(load_nwsl_pbp(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/pbp/rds/play_by_play_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` ``` -------------------------------- ### Function signature: load_nwsl_schedule() Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_schedule.html Shows the usage signature of the load_nwsl_schedule() function with its arguments: seasons, ..., dbConnection, and tablename. The seasons argument defaults to most_recent_nwsl_season(). ```R load_nwsl_schedule( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` -------------------------------- ### Function Usage: load_nwsl_player_box Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_player_box.html Shows the function signature with default season from most_recent_nwsl_season() and optional database connection parameters. ```r load_nwsl_player_box( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` -------------------------------- ### load_nwsl_pbp function usage Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_pbp.html Function signature for loading NWSL play-by-play data. Accepts a vector of seasons (minimum 2002), optional database connection and table name, and additional arguments for database writing. ```r load_nwsl_pbp( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` -------------------------------- ### Usage: espn_nwsl_pbp(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_pbp.html Function signature for retrieving NWSL play-by-play data. The game_id argument is required. ```R espn_nwsl_pbp(game_id) ``` -------------------------------- ### espn_nwsl_teams() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's NWSL team names and ids. ```APIDOC ## espn_nwsl_teams() ### Description Get ESPN's NWSL team names and ids. ### Usage espn_nwsl_teams() ### Source ESPN's API ``` -------------------------------- ### csv_from_url(...) Source: https://usfootballr.sportsdataverse.org/reference/csv_from_url.html Load a .csv or .csv.gz file from a remote connection. This is a thin wrapper on data.table::fread, passing all arguments through. ```APIDOC ## csv_from_url(...) ### Description Load a .csv or .csv.gz file from a remote connection. This is a thin wrapper on data.table::fread, passing all arguments through. ### Usage ```r csv_from_url(...) ``` ### Arguments - **...** - Arguments passed to data.table::fread. ``` -------------------------------- ### espn_mls_team_box() Source: https://usfootballr.sportsdataverse.org/reference/index.html Gets ESPN's MLS team box data. ```APIDOC ## espn_mls_team_box() ### Description Get ESPN's MLS team box data. ### Usage espn_mls_team_box() ### Source ESPN's API ``` -------------------------------- ### Usage: espn_nwsl_game_all(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_game_all.html Shows the function signature for espn_nwsl_game_all. The function takes a single argument, game_id, which is the ESPN game ID. ```R espn_nwsl_game_all(game_id) ``` -------------------------------- ### load_nwsl_player_box() Source: https://usfootballr.sportsdataverse.org/reference/index.html Loads usfootballR NWSL player box scores from the usfootballR-data repository. ```APIDOC ## load_nwsl_player_box() ### Description Load usfootballR NWSL player box scores. ### Usage load_nwsl_player_box() ### Source usfootballR-data repository ``` -------------------------------- ### update_nwsl_db() Source: https://usfootballr.sportsdataverse.org/reference/index.html Updates or creates a usfootballR play-by-play database for NWSL data. ```APIDOC ## update_nwsl_db() ### Description Update or create a usfootballR play-by-play database. ### Usage update_nwsl_db() ### Source usfootballR-data repository ``` -------------------------------- ### Function signature: load_mls_pbp() Source: https://usfootballr.sportsdataverse.org/reference/load_mls_pbp.html The usage block shows the function signature with its arguments: seasons, ..., dbConnection, and tablename. The seasons argument defaults to the most recent MLS season, and the dots are passed to an underlying database-writing function. ```R load_mls_pbp( seasons = most_recent_mls_season(), ..., dbConnection = NULL, tablename = NULL ) ``` -------------------------------- ### load_mls_pbp Source: https://usfootballr.sportsdataverse.org/reference/load_mls_pbp.html Loads multiple seasons of MLS play-by-play data from the data repository into memory or writes it to a database. ```APIDOC ## load_mls_pbp ### Description Helper that loads multiple seasons from the data repo either into memory or writes it into a db using some forwarded arguments in the dots. ### Usage ```r load_mls_pbp( seasons = most_recent_mls_season(), ..., dbConnection = NULL, tablename = NULL ) ``` ### Arguments - **seasons** (vector of integers) - A vector of 4-digit years associated with given MLS seasons. (Min: 2002) - **...** (additional arguments) - Additional arguments passed to an underlying function that writes the season data into a database (used by `update_mls_db()`). - **dbConnection** (DBIConnection) - A `DBIConnection` object, as returned by `DBI::dbConnect()`. - **tablename** (character) - The name of the play by play data table within the database. ### Value A dataframe. ### Examples ```r \donttest{ try(load_mls_pbp(2021)) } ``` ``` -------------------------------- ### load_nwsl_schedule Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_schedule.html Loads NWSL schedule data for one or more seasons from the data repository, either into memory or into a database connection. ```APIDOC ## load_nwsl_schedule ### Description Loads NWSL schedule data for multiple seasons from the data repository, either into memory or into a database using forwarded arguments. ### Usage ```r load_nwsl_schedule( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` ### Arguments - **seasons** (vector of integers) - Required - A vector of 4-digit years associated with given NWSL seasons. Minimum is 2002. - **...** (additional arguments) - Optional - Additional arguments passed to an underlying function that writes the season data into a database (used by `update_nwsl_db()`). - **dbConnection** (DBIConnection) - Optional - A `DBIConnection` object, as returned by `DBI::dbConnect()`. - **tablename** (character) - Optional - The name of the schedule data table within the database. ### Value Returns a tibble. ### Examples ```r # \donttest{ try(load_nwsl_schedule(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/schedules/rds/nwsl_schedule_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` ``` -------------------------------- ### Function usage: espn_mls_pbp(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_pbp.html Shows the function signature for espn_mls_pbp, which takes a game_id argument and returns a play-by-play data frame. ```r espn_mls_pbp(game_id) ``` -------------------------------- ### Function usage: espn_mls_game_all(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_mls_game_all.html Shows the function signature for espn_mls_game_all, which takes a game_id argument and returns a named list of dataframes: Plays and Team. ```r espn_mls_game_all(game_id) ``` -------------------------------- ### load_nwsl_team_box() Source: https://usfootballr.sportsdataverse.org/reference/index.html Loads usfootballR NWSL team box scores from the usfootballR-data repository. ```APIDOC ## load_nwsl_team_box() ### Description Load usfootballR NWSL team box scores. ### Usage load_nwsl_team_box() ### Source usfootballR-data repository ``` -------------------------------- ### load_nwsl_team_box() function usage Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_team_box.html Shows the function signature with arguments: seasons (defaults to most_recent_nwsl_season()), ... (for database writing), dbConnection (a DBIConnection), and tablename. Use this to load NWSL team box scores for one or more seasons. ```r load_nwsl_team_box( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` -------------------------------- ### Function usage: espn_nwsl_team_box(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_team_box.html Shows the function signature for espn_nwsl_team_box, which takes a game_id argument and returns a team boxscore data frame. ```r espn_nwsl_team_box(game_id) ``` -------------------------------- ### load_mls_schedule() Source: https://usfootballr.sportsdataverse.org/reference/load_mls_schedule.html Loads MLS schedule data for specified seasons from the data repository, either into memory or into a database connection. ```APIDOC ## load_mls_schedule() ### Description Loads multiple seasons of MLS schedule data from the data repository into memory or writes it into a database using forwarded arguments. ### Usage ```r load_mls_schedule( seasons = most_recent_mls_season(), ..., dbConnection = NULL, tablename = NULL ) ``` ### Arguments - **seasons** (vector of integers) - A vector of 4-digit years associated with given MLS seasons. (Min: 2002) - **...** (additional arguments) - Additional arguments passed to an underlying function that writes the season data into a database (used by `update_mls_db()`). - **dbConnection** (DBIConnection) - A `DBIConnection` object, as returned by `DBI::dbConnect()`. - **tablename** (character) - The name of the schedule data table within the database. ### Value Returns a tibble. ### Example ```r # \donttest{ try(load_mls_schedule(2021)) # } ``` ``` -------------------------------- ### rds_from_url() Source: https://usfootballr.sportsdataverse.org/reference/index.html Loads a .rds file from a remote connection. ```APIDOC ## rds_from_url() ### Description Load .rds file from a remote connection. ### Usage rds_from_url() ### Source Helper function ``` -------------------------------- ### Usage: espn_nwsl_teams() Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_teams.html Function signature for retrieving NWSL team data from ESPN. ```r espn_nwsl_teams() ``` -------------------------------- ### Usage: espn_nwsl_scoreboard(season) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_scoreboard.html Function signature for retrieving NWSL schedule data from ESPN's API. The season argument can be numeric or character. ```R espn_nwsl_scoreboard(season) ``` -------------------------------- ### load_nwsl_team_box(seasons, ..., dbConnection, tablename) Source: https://usfootballr.sportsdataverse.org/reference/load_nwsl_team_box.html Loads NWSL team box scores for specified seasons. It can return a tibble or write to a database if a connection and table name are provided. ```APIDOC ## load_nwsl_team_box(seasons, ..., dbConnection, tablename) ### Description Helper that loads multiple seasons of NWSL team box scores from the data repo either into memory or writes it into a db using some forwarded arguments in the dots. ### Usage ```r load_nwsl_team_box( seasons = most_recent_nwsl_season(), ..., dbConnection = NULL, tablename = NULL ) ``` ### Arguments - **seasons** (vector of integers) - A vector of 4-digit years associated with given NWSL seasons. (Min: 2003) - **...** - Additional arguments passed to an underlying function that writes the season data into a database (used by `update_nwsl_db()`). - **dbConnection** (DBIConnection) - A `DBIConnection` object, as returned by `DBI::dbConnect()`. - **tablename** (character) - The name of the team box data table within the database. ### Value Returns a tibble. ### Examples ```r # \donttest{ try(load_nwsl_team_box(2021)) #> Warning: cannot open URL 'https://raw.githubusercontent.com/saiemgilani/usfootballR-data/master/nwsl/team_box/rds/team_box_2021.rds': HTTP status was '404 Not Found' #> Warning: Failed to readRDS from #> # A tibble: 0 × 0 # } ``` ``` -------------------------------- ### update_mls_db() Source: https://usfootballr.sportsdataverse.org/reference/update_mls_db.html Updates or creates a database with usfootballR play-by-play data of all completed and available games since 2002. ```APIDOC ## update_mls_db() ### Description Updates or creates a database with usfootballR play-by-play data of all completed and available games since 2002. ### Usage ```r update_mls_db( dbdir = ".", dbname = "usfootballR_db", tblname = "usfootballR_mls_pbp", force_rebuild = FALSE, db_connection = NULL ) ``` ### Arguments - **dbdir** (character) - Directory in which the database is or shall be located. - **dbname** (character) - File name of an existing or desired SQLite database within `dbdir`. - **tblname** (character) - The name of the play by play data table within the database. - **force_rebuild** (logical or numeric) - Hybrid parameter to rebuild parts of or the complete play by play data table within the database. See details. - **db_connection** (DBIConnection) - A `DBIConnection` object, as returned by `DBI::dbConnect()`. See details. ### Value Logical TRUE/FALSE ### Details This function creates and updates a data table with the name `tblname` within a SQLite database (other drivers via `db_connection`) located in `dbdir` and named `dbname`. The data table combines all play by play data for every available game back to the 2002 season and adds the most recent completed games as soon as they are available for `usfootballR`. The argument `force_rebuild` is of hybrid type. It can rebuild the play by play data table either for the whole usfootballR era (with `force_rebuild = TRUE`) or just for specified seasons (e.g. `force_rebuild = c(2019, 2020)`). Please note the following behavior: - `force_rebuild = TRUE`: The data table with the name `tblname` will be removed completely and rebuilt from scratch. This is helpful when new columns are added during the Off-Season. - `force_rebuild = c(2019, 2020)`: The data table with the name `tblname` will be preserved and only rows from the 2019 and 2020 seasons will be deleted and re-added. This is intended to be used for ongoing seasons because ESPN's data provider can make changes to the underlying data during the week. The parameter `db_connection` is intended for advanced users who want to use other DBI drivers, such as MariaDB, Postgres or odbc. Please note that the arguments `dbdir` and `dbname` are dropped in case a `db_connection` is provided but the argument `tblname` will still be used to write the data table into the database. ``` -------------------------------- ### load_mls_player_box function usage Source: https://usfootballr.sportsdataverse.org/reference/load_mls_player_box.html Function signature for load_mls_player_box. It accepts a vector of seasons (minimum 2002), optional arguments for database writing, a DBIConnection object, and a table name. Returns a tibble. ```R load_mls_player_box( seasons = most_recent_mls_season(), ..., dbConnection = NULL, tablename = NULL ) ``` -------------------------------- ### update_nwsl_db() function usage Source: https://usfootballr.sportsdataverse.org/reference/update_nwsl_db.html Updates or creates a SQLite database with usfootballR play-by-play data for all completed games since 2002. The function accepts a directory, database file name, table name, a hybrid force_rebuild parameter, and an optional DBIConnection for advanced use. ```r update_nwsl_db( dbdir = ".", dbname = "usfootballR_db", tblname = "usfootballR_nwsl_pbp", force_rebuild = FALSE, db_connection = NULL ) ``` -------------------------------- ### load_mls_player_box() Source: https://usfootballr.sportsdataverse.org/reference/index.html Loads usfootballR MLS player box scores from the usfootballR-data repository. ```APIDOC ## load_mls_player_box() ### Description Load usfootballR MLS player box scores. ### Usage load_mls_player_box() ### Source usfootballR-data repository ``` -------------------------------- ### update_mls_db() function usage Source: https://usfootballr.sportsdataverse.org/reference/update_mls_db.html Shows the function signature and default arguments for update_mls_db(). The function updates or creates a database with play-by-play data for all completed and available games since 2002. The force_rebuild parameter can be TRUE to rebuild the entire table or a vector of seasons to rebuild specific seasons. ```r update_mls_db( dbdir = ".", dbname = "usfootballR_db", tblname = "usfootballR_mls_pbp", force_rebuild = FALSE, db_connection = NULL ) ``` -------------------------------- ### espn_nwsl_pbp(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_pbp.html Retrieves play-by-play data for a specified NWSL game from ESPN. The function takes a game ID and returns a data frame containing the play-by-play information. ```APIDOC ## espn_nwsl_pbp(game_id) ### Description Get ESPN's NWSL play by play data. ### Usage ```r espn_nwsl_pbp(game_id) ``` ### Arguments - **game_id** - Game ID ### Value Returns a play-by-play data frame. ### Author Saiem Gilani ### Examples ```r # \donttest{ try(espn_nwsl_pbp(game_id = 601833)) # } ``` ``` -------------------------------- ### load_mls_team_box() Source: https://usfootballr.sportsdataverse.org/reference/index.html Loads usfootballR MLS team box scores from the usfootballR-data repository. ```APIDOC ## load_mls_team_box() ### Description Load usfootballR MLS team box scores. ### Usage load_mls_team_box() ### Source usfootballR-data repository ``` -------------------------------- ### espn_nwsl_game_all(game_id) Source: https://usfootballr.sportsdataverse.org/reference/espn_nwsl_game_all.html Retrieves ESPN NWSL game data including play-by-play and team information for a specified game ID. Returns a named list of dataframes: Plays and Team. ```APIDOC ## espn_nwsl_game_all(game_id) ### Description Get ESPN's NWSL game data (play-by-play, team) ### Usage ```r espn_nwsl_game_all(game_id) ``` ### Arguments - **game_id** - Game ID ### Value A named list of dataframes: Plays, Team ### Author Saiem Gilani ### Examples ```r # \donttest{ try(espn_nwsl_game_all(game_id = 601833)) #> Error : lexical error: invalid char in json text. #> (right here) ------^ #> # } ``` ``` -------------------------------- ### update_mls_db() Source: https://usfootballr.sportsdataverse.org/reference/index.html Updates or creates a usfootballR play-by-play database for MLS data. ```APIDOC ## update_mls_db() ### Description Update or create a usfootballR play-by-play database. ### Usage update_mls_db() ### Source usfootballR-data repository ```