knitr::opts_chunk$set(echo = TRUE)
This is an API client to retrieve data from the Swedish Hockey League Open API.
You can install the package with devtools
.
devtools::install_github("filipwastberg/shlr")
To be able to use it you need to apply for a client id and client secret from http://doc.openapi.shl.se/.
When you have these you can save them as environment variables:
Sys.setenv('SHL_CLIENT_ID' = "xxxxxx") Sys.setenv('SHL_CLIENT_SECRET' = "xxxxxxxx")
If you need to repeat this procedure during start up then save them to your .Renviron
usually done by file.edit("~/.Renviron")
For example you can get the top 10 players of a team (or the whole league) using get_top10_player_stats()
.
library(shlr) get_top10_player_stats(season = "2017", team_id = "DIF")
You can aquire the same information but for only goalies with get_top10_player_stats()
.
You can get all the games for a season with get_games()
.
get_games(season = "2018")
Active teams and meta information about the teams:
get_teams()
The current standing in SHL:
get_team_standing(season = "2018")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.