nhl_players: Retrieve metadata for players based on names or ids

Description Usage Arguments Value Examples

View source: R/nhl_players.R

Description

Retrieves information on players from the NHL API based on playerNames or playerIds. If playerNames are provided, they take precedence over playerIds.

Usage

1
nhl_players(playerNames, playerIds = NULL)

Arguments

playerNames

character(), vector of one or more player names. Not case sensitive for convenience.

playerIds

integer(), vector of one or more ids of the players. The ids correspond to the ids expected by the NHL API people endpoint. For most cases the playerNames argument can be provided for more convenient usage.

Value

data.frame, with information on selected players.

Examples

1
2
3
4
5
6
7
8
## Not run: 
 # With player names
 nhl_players(c("joe SAKIC", "patrick roy"))

 # With playerIds
 nhl_players(playerIds = c(8451101, 8458554))

## End(Not run)

Example output

04:36:03 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451101 error for attempt no: 0 Could not resolve host: statsapi.web.nhl.com
04:36:04 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451101 error for attempt no: 1 Could not resolve host: statsapi.web.nhl.com
04:36:05 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451101 error for attempt no: 2 Could not resolve host: statsapi.web.nhl.com
04:36:05 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451033 error for attempt no: 0 Could not resolve host: statsapi.web.nhl.com
04:36:06 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451033 error for attempt no: 1 Could not resolve host: statsapi.web.nhl.com
04:36:07 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451033 error for attempt no: 2 Could not resolve host: statsapi.web.nhl.com
04:36:07 | 4 | E | The following 2 of 2 url retrievals errored:$ https://statsapi.web.nhl.com/api/v1/people/8451101$ https://statsapi.web.nhl.com/api/v1/people/8451033 
data frame with 0 columns and 0 rows
04:36:07 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451101 error for attempt no: 0 Could not resolve host: statsapi.web.nhl.com
04:36:08 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451101 error for attempt no: 1 Could not resolve host: statsapi.web.nhl.com
04:36:09 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8451101 error for attempt no: 2 Could not resolve host: statsapi.web.nhl.com
04:36:09 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8458554 error for attempt no: 0 Could not resolve host: statsapi.web.nhl.com
04:36:10 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8458554 error for attempt no: 1 Could not resolve host: statsapi.web.nhl.com
04:36:11 | 6 | W | nhl_from_json https://statsapi.web.nhl.com/api/v1/people/8458554 error for attempt no: 2 Could not resolve host: statsapi.web.nhl.com
04:36:11 | 4 | E | The following 2 of 2 url retrievals errored:$ https://statsapi.web.nhl.com/api/v1/people/8451101$ https://statsapi.web.nhl.com/api/v1/people/8458554 
data frame with 0 columns and 0 rows

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