This function aggregates player statistics and play-by-play information
within a season by applying player_season_stats()
, player_match_stats()
,
or match_pbp()
across groups of teams (for player_season_stats()
) or
across contests within a season (for player_match_stats()
and
match_pbp()
). For season stats, it aggregates all player data and team
data into separate data frames and combines them into a list.
For instance, if you want to extract the data from the teams in the women's
2024 Final Four, pass a vector of
c("Louisville", "Nebraska", "Penn State", "Pittsburgh")
to the function. For match or play-by-play data for a team, pass a single
team name and year. Team names can be found in ncaa_teams or by
using find_team_name()
.
Arguments
- teams
Character vector of team names to aggregate.
- year
Numeric vector of years for fall of desired seasons.
- level
Character string defining whether to aggregate "season", "match", or play-by-play ("pbp") data.
- unique
Logical indicating whether to only process unique contests (TRUE) or whether to process duplicated contests (FALSE). Default is TRUE.
- sport
Three letter abbreviation for NCAA sport (must be upper case; for example "WVB" for women's volleyball and "MVB" for men's volleyball).
Value
For season level, returns list with data frames of player statistics and team statistics. For match and pbp levels, returns data frame of player statistics and play-by-play information respectively.
See also
Other functions that aggregate statistics:
conference_stats()
,
division_stats()
Examples
# \donttest{
group_stats(teams = c("Louisville", "Nebraska", "Penn St.", "Pittsburgh"),
year = 2024, level = "season")
#> $playerdata
#> # A tibble: 60 × 29
#> Season Team Conference Number Player Yr Pos Ht Hometown
#> <chr> <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 2024-2025 Louisville ACC 3 Kamden Sch… So L/DS 5-6 Villa H…
#> 2 2024-2025 Louisville ACC 4 Charitie L… Jr OH 5-9 Dallas,…
#> 3 2024-2025 Louisville ACC 5 Elle Glock Jr S 6-1 Wahoo, …
#> 4 2024-2025 Louisville ACC 6 Sofia Mald… Sr OH 6-0 Guadala…
#> 5 2024-2025 Louisville ACC 8 Nayelis Ca… Fr S 6-0 Clermon…
#> 6 2024-2025 Louisville ACC 10 Phekran PK… Sr MB 6-3 Sioux F…
#> 7 2024-2025 Louisville ACC 11 Hannah She… Jr MB 6-1 Silver …
#> 8 2024-2025 Louisville ACC 12 Jessica Dr… So L/DS 5-6 Cincinn…
#> 9 2024-2025 Louisville ACC 13 Cara Cresse Sr MB 6-6 Ft. Way…
#> 10 2024-2025 Louisville ACC 14 Anna DeBeer Sr OH 6-0 Louisvi…
#> # ℹ 50 more rows
#> # ℹ 20 more variables: `High School` <chr>, GP <dbl>, GS <dbl>, S <dbl>,
#> # Kills <dbl>, Errors <dbl>, `Total Attacks` <dbl>, `Hit Pct` <dbl>,
#> # Assists <dbl>, Aces <dbl>, SErr <dbl>, Digs <dbl>, RetAtt <dbl>,
#> # RErr <dbl>, `Block Solos` <dbl>, `Block Assists` <dbl>, BErr <dbl>,
#> # PTS <dbl>, BHE <dbl>, `Trpl Dbl` <dbl>
#>
#> $teamdata
#> # A tibble: 4 × 20
#> Season Team Conference S Kills Errors `Total Attacks` `Hit Pct` Assists
#> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2024-20… Loui… ACC 127 1707 600 4096 0.27 1588
#> 2 2024-20… Nebr… Big Ten 122 1721 551 4114 0.284 1596
#> 3 2024-20… Penn… Big Ten 135 1972 648 4673 0.283 1841
#> 4 2024-20… Pitt… ACC 117 1647 447 3619 0.332 1542
#> # ℹ 11 more variables: Aces <dbl>, SErr <dbl>, Digs <dbl>, RetAtt <dbl>,
#> # RErr <dbl>, `Block Solos` <dbl>, `Block Assists` <dbl>, BErr <dbl>,
#> # PTS <dbl>, BHE <dbl>, `Trpl Dbl` <dbl>
#>
# }