util_map_player_id: Retrieve a player id from the name

Description Usage Arguments Value Examples

View source: R/nhl_utils.R

Description

Using a table of hashed names and ids, get a player id based on the name.

Usage

1
util_map_player_id(x, map = getOption("nhlapi_player_map"))

Arguments

x

character(1) a player's name, not case sensitive for convenience.

map

data.frame, with 2 columns:

  • nameMd5: character() of hashed player names

  • id: integer() of player ids used by the NHL API

Value

integer(1), id of the player or NA_integer if not found.

Examples

1
2
3
4
5
6
7
8
  nhlapi:::util_map_player_id(
   "Joe Sakic",
   data.frame(
     nameMd5 = "9d2a915c8610dbc524c1bc800e010fcc",
     id = 19L,
     stringsAsFactors = FALSE
   )
 )

Example output

[1] 19

nhlapi documentation built on Feb. 20, 2021, 9:06 a.m.