Skip to content

Instantly share code, notes, and snippets.

@sangamc
Forked from tcash21/rush_yards.R
Created August 22, 2016 20:47
Show Gist options
  • Save sangamc/df4b0ea9b39e4b5e9797c277a6e65636 to your computer and use it in GitHub Desktop.
Save sangamc/df4b0ea9b39e4b5e9797c277a6e65636 to your computer and use it in GitHub Desktop.
devtools::install_github("stattleship/stattleship-r")
library(stattleshipR)
## Get a free Stattleship API token from www.stattleship.com
set_token('set-your-token')
sport <- 'football'
league <- 'nfl'
ep <- 'game_logs'
q_body <- list(player_id = 'nfl-james-starks')
starks <- ss_get_result(sport=sport, league=league, ep=ep, query=q_body, version=1, verbose=TRUE, walk=TRUE)
q_body <- list(player_id = 'nfl-eddie-lacy')
lacy <- ss_get_result(sport=sport, league=league, ep=ep, query=q_body, version=1, verbose=TRUE, walk=TRUE)
starks_rush_yards <- starks[[1]]$game_logs$rushes_yards
lacy_rush_yards <- lacy[[1]]$game_logs$rushes_yards
> sd(starks_rush_yards)
[1] 31.34957
> sd(lacy_rush_yards, na.rm=TRUE)
[1] 40.70954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment