Skip to contents

One game's team totals: shots by period, faceoffs by zone, power play and penalty kill.

Usage

nl_team_stats(game_id, return_parsed = TRUE)

Arguments

game_id

SIHF game id, 14 digits <season(4)><competition(4)><sequence(6)> (game_id in nl_schedule(); the same id as the SIHF family's game_id), e.g. 20261105000325. A whole number or a digit string; 14 digits are exact as a double, so do not format them through integer.

return_parsed

Logical. TRUE (the default) returns the fastRhockey_data tibble; FALSE returns the raw JSON body as a nested list (api keys already dropped).

Value

A fastRhockey_data tibble (40 columns) with the columns below, or the raw JSON body when return_parsed = FALSE. A valid but empty payload returns a zero-row tibble with these columns.

col_nametypedescription
game_idnumericSIHF game id <season(4)><competition(4)><sequence(6)> (whole number; e.g. 20261105000325, 1105 = National League). The same id as the sihf family's game_id; its first four digits are the season END year.
team_sidecharacterhome or away: the side of the team this row belongs to.
team_idnumericSIHF team id (whole number; e.g. 101151 = HC Davos). The same key space as the sihf family's team_id.
gintegerNumber of goals scored
gaintegerGoals against: number of goals conceded
saintegerShots on goal against
sog1integerShots on goal in the 1st period
sog2integerShots on goal in the 2nd period
sog3integerShots on goal in the 3rd period
sog_otintegerShots on goal in overtime, all periods
sog_ot1integerShots on goal in overtime period 1
sog_ot2integerShots on goal in overtime period 2
sog_ot3integerShots on goal in overtime period 3
shmintegerShots that missed the net
shpintegerShots that hit the post
shbintegerOwn shots blocked by an opponent
bksintegerOpponent shots blocked
fow_dintegerDefensive-zone faceoffs won (0 in every sampled game)
fow_nintegerNeutral-zone faceoffs won (0 in every sampled game)
fow_ointegerOffensive-zone faceoffs won (0 in every sampled game)
fol_nintegerNeutral-zone faceoffs lost (0 in every sampled game)
fol_ointegerOffensive-zone faceoffs lost (0 in every sampled game)
fol_dintegerDefensive-zone faceoffs lost (0 in every sampled game)
pptintegerPower-play time, seconds
ppointegerPower-play opportunities
ppgintegerPower-play goals
ppgaintegerShorthanded goals allowed while on the power play
pktintegerShorthanded time, seconds
pksintegerTimes shorthanded
pkgintegerShorthanded goals scored
pkgaintegerPower-play goals allowed while shorthanded
faceoffsintegerFaceoffs taken (upstream fo: fow + fol). Not penalties.
pimintegerPenalty minutes
sogintegerNumber of shots on goal
sog_percentagenumericShooting percentage, 100 * g / sog
pp_percentagenumericPower-play percentage, 100 * ppg / ppo
pk_percentagenumericPenalty-kill percentage, 0-100
fowintegerNumber of faceoffs won
folintegerNumber of faceoffs lost
faceoffs_percentagenumericFaceoff win percentage (upstream foPercentage); -1 without faceoffs.

Details

robots.txt ruling. www.nationalleague.ch/robots.txt disallows /api. The owner approved building on it on 2026-10-12, for polite, incremental use only: requests are spaced at least one second apart (on every attempt, retries included), and a bulk backfill or a published mirror needs the owner's sign-off first. Crawl incrementally: fetch a finished game once (keyed by game_id), find new games with one nl_schedule() call per run, and fetch season tables at most once per game day.

Seasons are END years and go on the wire unchanged. Ids (*_id) are whole-number numeric (a 14-digit game_id exceeds R's 32-bit integer); every other whole-number column is integer. The club backend key the API ships in /teams/{id}/info is dropped before parsing and never returned.

Endpoint: GET https://www.nationalleague.ch/api/games/{gameId}.

The six game-page wrappers (nl_game_overview(), nl_pbp(), nl_lineups(), nl_player_box(), nl_team_stats(), nl_shots()) each read the same /games/{gameId} body, one request each.

Errors

Raises a classed condition (all inherit fastRhockey_error): fastRhockey_no_data for a 404 or an empty answer (no games or rows for that season, team or phase), fastRhockey_asset_fetch for a failed fetch, an error object in a 200, a body without the ids it must carry, or an answer for another season, team, game or player, and fastRhockey_bad_request for a 400/422 or an argument that is not a whole number.

Examples

# \donttest{
  try(nl_team_stats(game_id = 20261105000325))
#> ── National League Team Stats Information from nationalleague.ch ───────────────
#> ℹ Data updated: 2026-10-13 01:58:37 UTC
#> # A tibble: 2 × 40
#>   game_id team_side team_id     g    ga    sa  sog1  sog2  sog3 sog_ot sog_ot1
#>     <dbl> <chr>       <dbl> <int> <int> <int> <int> <int> <int>  <int>   <int>
#> 1 2.03e13 home       101151     4     3    22    11    16     9      0       0
#> 2 2.03e13 away       102127     3     4    36     7     8     7      0       0
#> # ℹ 29 more variables: sog_ot2 <int>, sog_ot3 <int>, shm <int>, shp <int>,
#> #   shb <int>, bks <int>, fow_d <int>, fow_n <int>, fow_o <int>, fol_n <int>,
#> #   fol_o <int>, fol_d <int>, ppt <int>, ppo <int>, ppg <int>, ppga <int>,
#> #   pkt <int>, pks <int>, pkg <int>, pkga <int>, faceoffs <int>, pim <int>,
#> #   sog <int>, sog_percentage <dbl>, pp_percentage <dbl>, pk_percentage <dbl>,
#> #   fow <int>, fol <int>, faceoffs_percentage <dbl>
# }