The function get_players_id() is meant to be a user-friendly way of getting NHL players ID using their name, date of birth and/or primary position type.

get_players_id(players_name, players_dob = NULL, players_position_type = NULL)

Arguments

players_name

Character vector representing the name of the players

players_dob

(optional) Date vector representing the date of birth of the players

players_position_type

(optional) Character vector representing the position type (F, D, or G) of the players

Examples

# Get the NHL ID of Vincent Lecavalier get_players_id("Vincent Lecavalier")
#> [1] 8467329
# Get the NHL ID of both Vincent Lecavalier and Josh Anderson get_players_id(c("Vincent Lecavalier", "Josh Anderson"))
#> Warning: multiple IDs matching for Josh Anderson (8476981, 8479340), highest (most recent) was returned
#> [1] 8467329 8479340
# Get the NHL ID of Josh Anderson born May 7, 1994 get_players_id("Josh Anderson", players_dob = as.Date("1994-05-07"))
#> [1] 8476981