map_filters: Translate key-value pairs to the stats.nba.com API key-value...

Description Usage Arguments Details Value

Description

Translates the key-values in a named list of statsnbaR key-value pairs to key-value pairs that the stats.nba.com API recognises for use in the calls to httr::GET in api_scrape.

Usage

1
map_filters(filters, api.endpoint)

Arguments

filters

The statsnbaR filter key-value pairs.

api.endpoint

statsnbaR specification of the stats.nba.com API endpoint

Details

The stats.nba.com API end-point description is given in the internal YAML which provides the translation of keys that statsnbaR specifies to keys that stats.nba.com recognises, e.g. ‘league’ in statsnbaR is translated to “LeagueID” for stats.nba.com in this example:

1
2
3
4
5
endpoints :
    PlayerCommon :
         api.filters  :
             league       : "LeagueID"
             ...

The values are mapped according to the filter mappings also specified in the internal YAML data, e.g:

1
2
3
4
5
6
7
8
filters :
    league :
        mapping : {
            NBA      : "00",
            D-League : "20"
            }
        default : NBA
    ...

Thus ‘NBA’ would be mapped to “00”.

#' @seealso map_filter_values

Value

Named list of statsnbaR key-values mapped to stats.nba.com API key-value pairs.


stephematician/statsnbaR documentation built on May 30, 2019, 3:17 p.m.