| Title: | A College Sports Recruiting Package |
|---|---|
| Description: | As a college sports recruiting package, recruitR provides users with the access to 247 Composite rankings and recruit information from the CollegeFootballData API. |
| Authors: | Saiem Gilani [aut, cre], Ryan Mann [aut] |
| Maintainer: | Saiem Gilani <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.3 |
| Built: | 2026-10-12 15:51:35 UTC |
| Source: | https://github.com/sportsdataverse/recruitR |
This dataframes is used internally to identify conference names and use the abbreviation in the function call for data
cfb_conf_types_dfcfb_conf_types_df
A data frame with 11 rows and 4 variables:
Referencing conference id
Conference name
Short name for Conference
Conference abbreviation
...
https://api.collegefootballdata.com
Get player recruiting rankings
cfbd_recruiting_player( year = NULL, team = NULL, recruit_type = "HighSchool", state = NULL, position = NULL )cfbd_recruiting_player( year = NULL, team = NULL, recruit_type = "HighSchool", state = NULL, position = NULL )
year |
(Integer optional): Year, 4 digit format (YYYY) - Minimum: 2000, Maximum: 2020 currently |
team |
(String optional): D-I Team |
recruit_type |
(String optional): default API return is 'HighSchool', other options include 'JUCO' or 'PrepSchool' - For position group information |
state |
(String optional): Two letter State abbreviation |
position |
(String optional): Position Group - options include:
|
cfbd_recruiting_player() - A data frame with 14 variables:
id: integer.Referencing id - 247Sports.
athlete_idAthlete referencing id.
recruit_type: character.High School, Prep School, or Junior College.
year: integer.Recruit class year.
ranking: integer.Recruit Ranking.
name: character.Recruit Name.
school: character.School recruit attended.
committed_to: character.School the recruit is committed to.
position: character.Recruit position.
height: double.Recruit height.
weight: integer.Recruit weight.
stars: integer.Recruit stars.
rating: double.247 composite rating.
city: character.Hometown of the recruit.
state_province: character.Hometown state of the recruit.
country: character.Hometown country of the recruit.
hometown_info_latitude: character.Hometown latitude.
hometown_info_longitude: character.Hometown longitude.
hometown_info_fips_code: character.Hometown FIPS code.
try(cfbd_recruiting_player(2018, team = "Texas")) try(cfbd_recruiting_player(2016, recruit_type = "JUCO")) try(cfbd_recruiting_player(2020, recruit_type = "HighSchool", position = "OT", state = "FL"))try(cfbd_recruiting_player(2018, team = "Texas")) try(cfbd_recruiting_player(2016, recruit_type = "JUCO")) try(cfbd_recruiting_player(2020, recruit_type = "HighSchool", position = "OT", state = "FL"))
Get college football position group recruiting information.
cfbd_recruiting_position( start_year = NULL, end_year = NULL, team = NULL, conference = NULL )cfbd_recruiting_position( start_year = NULL, end_year = NULL, team = NULL, conference = NULL )
start_year |
(Integer optional): Start Year, 4 digit format (YYYY). Note: 2000 is the minimum value |
end_year |
(Integer optional): End Year, 4 digit format (YYYY). Note: 2020 is the maximum value currently |
team |
(String optional): Team - Select a valid team, D-I football |
conference |
(String optional): Conference abbreviation - Select a valid FBS conference Conference abbreviations P5: ACC, B12, B1G, SEC, PAC Conference abbreviations G5 and FBS Independents: CUSA, MAC, MWC, Ind, SBC, AAC |
cfbd_recruiting_position() - A data frame with 7 variables:
team: character.Recruiting team.
conference: character.Recruiting team conference.
position_group: character.Position group of the recruits.
avg_rating: double.Average rating of the recruits in the position group.
total_rating: double.Sum of the ratings of the recruits in the position group.
commits: integer.Number of commits in the position group.
avg_stars: double.Average stars of the recruits in the position group.
try(cfbd_recruiting_position(2018, team = "Texas")) try(cfbd_recruiting_position(2016, 2020, team = "Virginia")) try(cfbd_recruiting_position(2015, 2020, conference = "SEC"))try(cfbd_recruiting_position(2018, team = "Texas")) try(cfbd_recruiting_position(2016, 2020, team = "Virginia")) try(cfbd_recruiting_position(2015, 2020, conference = "SEC"))
Get college football recruiting team rankings information.
cfbd_recruiting_team(year = NULL, team = NULL)cfbd_recruiting_team(year = NULL, team = NULL)
year |
(Integer optional): Recruiting Class Year, 4 digit format (YYYY). Note: 2000 is the minimum value |
team |
(String optional): Team - Select a valid team, D1 football |
cfbd_recruiting_team() - A data frame with 4 variables:
year: integer.Recruiting class year.
rank: integer.Team Recruiting rank.
team: character.Recruiting Team.
points: character.Team talent points.
try(cfbd_recruiting_team(2018, team = "Texas")) try(cfbd_recruiting_team(2016, team = "Virginia")) try(cfbd_recruiting_team(2016, team = "Texas A&M")) try(cfbd_recruiting_team(2011))try(cfbd_recruiting_team(2018, team = "Texas")) try(cfbd_recruiting_team(2016, team = "Virginia")) try(cfbd_recruiting_team(2016, team = "Texas A&M")) try(cfbd_recruiting_team(2011))
Get Transfer Portal Data
cfbd_recruiting_transfer_portal(year)cfbd_recruiting_transfer_portal(year)
year |
(Integer required): Year of the offseason (2021 would return transfer portal data starting from the end of the 2020 season), 4 digit format (YYYY). |
cfbd_recruiting_transfer_portal() - A data frame with 11 variables:
season:integerSeason of transfer.
first_name:character.Player's first name.
last_name:character.Player's last name.
position:character.Player position.
origin:character.original team.
destination:character.new team.
transfer_date:character.Date of transfer.
rating:character.Player's 247 transfer rating.
stars:integerPlayer's star rating.
eligibilty:character.Player's eligibilty status.
try(cfbd_recruiting_transfer_portal(year = 2021))try(cfbd_recruiting_transfer_portal(year = 2021))
Get a teams full roster by year. If team is not selected, API returns rosters for every team from the selected year.
cfbd_team_roster(year, team = NULL)cfbd_team_roster(year, team = NULL)
year |
(Integer required): Year, 4 digit format (YYYY) |
team |
(String optional): Team, select a valid team in D-I football |
cfbd_team_roster() - A data frame with 12 variables:
athlete_id: character.Referencing athlete id.
first_name: character.Athlete first name.
last_name: character.Athlete last name.
team: character.Team name.
weight: integer.Athlete weight.
height: integer.Athlete height.
jersey: integer.Athlete jersey number.
year: integer.Athlete year.
position: character.Athlete position.
home_city: character.Hometown of the athlete.
home_state: character.Hometown state of the athlete.
home_country: character.Hometown country of the athlete.
home_latitude: numeric.Hometown latitude.
home_longitude: number.Hometown longitude.
home_county_fips: integer.Hometown FIPS code.
headshot_url: characterPlayer ESPN headshot url.
try(cfbd_team_roster(year = 2013, team = "Florida State"))try(cfbd_team_roster(year = 2013, team = "Florida State"))
Extracts team talent composite as sourced from 247 rankings
cfbd_team_talent(year = NULL)cfbd_team_talent(year = NULL)
year |
(Integer optional): Year 4 digit format (YYYY) |
cfbd_team_talent() - A data frame with 3 variables:
year: integer.Season for the talent rating.
school: character.Team name.
talent: double.Overall roster talent points (as determined by 247Sports).
try(cfbd_team_talent()) try(cfbd_team_talent(year = 2018))try(cfbd_team_talent()) try(cfbd_team_talent(year = 2018))
Pulls all college football venues and data on capacity, grass, city/state, location, elevation, dome, timezone and construction year.
cfbd_venues()cfbd_venues()
CFB Venue Information
cfbd_venues()
A data frame with 337 rows and 13 variables:
venue_id:integer.Referencing venue ID.
name:character.Venue name.
capacity:integer.Stadium capacity.
grass:logical.TRUE/FALSE response on whether the field is grass or not (oh, and there are so many others).
city:character.Venue city.
state:character.Venue state.
zip:character.Venue zip.
country_code:character.Venue country code.
location:list.Venue location.
elevation:character.Venue elevation.
year_constructed:integer.Year in which the venue was constructed.
dome:logical.TRUE/FALSE response to whether the venue has a dome or not.
timezone:character.Time zone in which the venue resides (i.e. Eastern Time -> "America/New York").
try(cfbd_venues())try(cfbd_venues())
This is a thin wrapper on data.table::fread
csv_from_url(...)csv_from_url(...)
... |
passed to data.table::fread |
Load .rds file from a remote connection
rds_from_url(url)rds_from_url(url)
url |
a character url |
a dataframe as created by readRDS()
Save your API Key as a system environment variable CFBD_API_KEY
cfbd_key() has_cfbd_key()cfbd_key() has_cfbd_key()
To get access to an API key, follow the instructions at https://collegefootballdata.com/key
Using the key:
You can save the key for consistent usage by adding CFBD_API_KEY=XXXX-YOUR-API-KEY-HERE-XXXXX to your .Renviron file (easily accessed via usethis::edit_r_environ()).
Run usethis::edit_r_environ(),
a new script will pop open named .Renviron, THEN
paste the following in the new script that pops up (without quotations)
CFBD_API_KEY = XXXX-YOUR-API-KEY-HERE-XXXXX
Save the script and restart your RStudio session, by clicking Session (in between Plots and Build) and click Restart R
(there also exists the shortcut Ctrl + Shift + F10 to restart your session).
If set correctly, from then on you should be able to use any of the cfbd_ functions without any other changes.
For less consistent usage:
At the beginning of every session or within an R environment,
save your API key as the environment variable CFBD_API_KEY (with quotations)
using a command like the following.
Sys.setenv(CFBD_API_KEY = "XXXX-YOUR-API-KEY-HERE-XXXXX")
Get 247 CFB Player Recruiting Rankings
tfs_recruiting_rankings(year, recruit_type = "HighSchool", pages = 5)tfs_recruiting_rankings(year, recruit_type = "HighSchool", pages = 5)
year |
(Integer optional): Year, 4 digit format (YYYY) - Minimum: 2000, Maximum: 2020 currently |
recruit_type |
(String optional): default API return is 'HighSchool', other options include 'JUCO' or 'PrepSchool' - For position group information |
pages |
Number of pages |
try(tfs_recruiting_rankings(2022))try(tfs_recruiting_rankings(2022))
Get 247 Recruitment
tfs_recruitment(recruitment_id)tfs_recruitment(recruitment_id)
recruitment_id |
(Integer) |
tfs_recruitment(recruitment_id = 130361)tfs_recruitment(recruitment_id = 130361)