Parse total team stats helper
get_tot_team_stats <- function (stat, stat_type, team_list, teams)
{
tmp_stats <- data.frame()
for (team in team_list) {
x <- ss_get_result(ep = "total_stats", query = list(stat = stat,
type = stat_type,
team_id = team),
verbose = FALSE)
tmp_df <- data.frame(id = x[[1]]$teams$id, temp_stat = x[[1]]$total_team_stat$total)
names(tmp_df)[ncol(tmp_df)] <- stat
tmp_df <- unique(tmp_df)
tmp_stats <- bind_rows(tmp_stats, tmp_df)
cat("finished ", team, "\n")
}
teams <<- left_join(teams, tmp_stats)
}