ss_get_result: Interface with the Stattleship API

Description Usage Arguments Value Examples

Description

A simple, generic function to query data from the Stattleship API

Usage

1
2
3
ss_get_result(token, sport = "hockey", league = "nhl", ep = "teams",
  query = list(), version = 1, walk = FALSE, page = NA,
  verbose = TRUE)

Arguments

sport

character. The sport, such as hockey, basketball, football, and baseball. Default is hockey.

league

character. NHL, NBA, NFL, and MLB. Default is nhl.

ep

character. The endpoint. Default is teams.

query

list. A list that defines the query parameters. Default is empty list.

version

numeric. The API version. Current version is 1 and is the default value.

walk

logical. If TRUE, walks through and returns all results if there is more than one page of results. Default is FALSE.

page

numeric. The page number to request. Default is NA.

verbose

logical. For debugging, prints status messages to the console, which can be helpful for walking through results. Default is TRUE.

Value

a list of lists. If 'walk=FALSE', it will be a list of length 1. If 'walk=TRUE', a list of lists may be returned depending on how many pages are returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
set_token("insert-your-token-here")
results <- ss_get_result(sport="hockey", 
                         league="nhl",
                         ep = "teams",
                         query = list()
                         version = 1,
                         walk = FALSE,
                         page = NA,
                         verbose = TRUE)

## End(Not run)

stattleship/stattleship-r documentation built on May 30, 2019, 10:43 a.m.