── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ purrr::flatten() masks jsonlite::flatten()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Search on Google for “Sleeper API Free”, then click the “Sleeper API: introduction”, then scroll down to players -> Fetch all players.
From there you will find
GET https://api.sleeper.app/v1/players/nfl
which we will use to pull the API. This website also includes an example of every column and what they are for example : “college”: “Michigan”
This is grabbing all players in the NFL and is not intended to be called every time so make sure you save to your own server. Not to be called more than once per day.
This first part is where you can search what position player you are looking for and where he his on the depth chart to find out if he plays a lot or not along with how many years of experience he has, along with many other criteria.
# A tibble: 3 × 10
player_id full_name position college status height weight years_exp team
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> <chr>
1 4046 Patrick Mahom… QB Texas … Active 74 225 8 KC
2 96 Aaron Rodgers QB Califo… Active 74 223 20 PIT
3 11563 Bo Nix QB Oregon Active 74 217 1 DEN
# ℹ 1 more variable: depth_chart_order <int>
This shows a select player based on their name and all its data.
TOP 10 # of players per position
top10_positions <- players_df %>%filter(!is.na(position)) %>%group_by(position) %>%summarise(count =n()) %>%slice_max(order_by = count, n =10) %>%arrange(desc(count))ggplot(top10_positions, aes(x =reorder(position, count), y = count)) +geom_col() +labs(title ="NFL player counts by position",x ="position",y ="# of players" )
This could be helpful for knowing which positions are sawed after and which positions there isn’t a lot of, to understand which positions a coach might want to go after in a Draft/Free Agency in order to better there team.