View source: R/cleaning_helpers.R
add_athlete_id_col | R Documentation |
This function attempts to add ESPN athlete ID's to a data frame using the roster data in the cfbfastR-data repo. The function is experimental and not guaranteed to be accurate.
add_athlete_id_col(df, name_col, team_col = NULL, headshot_urls = FALSE)
df |
a data frame. |
name_col |
the column in |
team_col |
Optional column with team names to join with the roster data to reduce
the chance of matching with two players from different teams with the same name. If NULL
and |
headshot_urls |
logical to return headshot URLs. If TRUE, the output has an additional column called "headshot_url" with links for player headshots. |
the original df
with extra columns:
athlete_id
athlete ESPN ID.
headshot_url
url of athlete's headshot.
x <- data.frame( player_name = c("Britain Covey","JT Daniels") ) cfbplotR::add_athlete_id_col(x, player_name) x$season <- c(2021,2021) cfbplotR::add_athlete_id_col(x, player_name) x$team = c("Utah","Georgia") cfbplotR::add_athlete_id_col(x, player_name, team, headshot_urls = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.