Skip to contents

Takes all columns ending with 'player_id' as well as the variables 'passer_id', 'rusher_id', 'fantasy_id', 'receiver_id', and 'id' of an nflfastR play-by-play data set and decodes the player IDs to the commonly known GSIS ID format 00-00xxxxx.

The function uses by default the high efficient decode_ids of the package gsisdecoder. In the unlikely event that there is a problem with this function, an nflfastR internal decoder can be used with the option fast = FALSE.

The 2022 play by play data introduced new player IDs that can't be decoded with gsisdecoder. In that case, IDs are joined through nflreadr::load_players.


decode_player_ids(pbp, ..., fast = TRUE)



is a Data frame of play-by-play data scraped using fast_scraper().


Additional arguments passed to a message function (for internal use).


If TRUE the IDs will be decoded with the high efficient function decode_ids. If FALSE an nflfastR internal function will be used for decoding (it is generally not recommended to do this, unless there is a problem with decode_ids which can take several days to fix on CRAN.)


The input data frame of the parameter pbp with decoded player IDs.


# \donttest{
# Decode data frame consisting of some names and ids
  name = c("P.Mahomes", "B.Baldwin", "P.Mahomes", "S.Carl", "J.Jones"),
  id = c(
#> • 19:14:20 | Decode player ids...
#>  19:14:20 | Decoding of player ids completed
#>        name         id
#> 1 P.Mahomes 00-0033873
#> 2 B.Baldwin       <NA>
#> 3 P.Mahomes 00-0033873
#> 4    S.Carl       <NA>
#> 5   J.Jones 00-0027944
# }