Functions for joining summary data to data frame. They perform respective variant of summarise item functions and then left join to the input its result (by item columns).

join_item_summary(tbl, item, ..., .prefix = "")

join_game_summary(tbl, ..., .prefix = "")

join_player_summary(tbl, ..., .prefix = "")

Arguments

tbl

Data frame.

item

Character vector of columns to group by.

...

Name-value pairs of summary functions (as in dplyr::summarise).

.prefix

A string to be added to all summary functions' names.

Value

Result of left_join() to the input data frame.

Details

join_game_summary() and join_player_summary() are wrappers for join_item_summary() using item = "game" and item = "player" respectively.

See also

Compute item summary

Common item summary functions for competition results.

Examples

ncaa2005 %>% join_player_summary(player_mean_score = mean(score))
#> # A longcr object: #> # A tibble: 20 x 4 #> game player score player_mean_score #> <int> <chr> <int> <dbl> #> 1 1 Duke 7 8.75 #> 2 1 Miami 52 34.5 #> 3 2 Duke 21 8.75 #> 4 2 UNC 24 12.5 #> 5 3 Duke 7 8.75 #> 6 3 UVA 38 18.5 #> 7 4 Duke 0 8.75 #> 8 4 VT 45 33.5 #> 9 5 Miami 34 34.5 #> 10 5 UNC 16 12.5 #> 11 6 Miami 25 34.5 #> 12 6 UVA 17 18.5 #> 13 7 Miami 27 34.5 #> 14 7 VT 7 33.5 #> 15 8 UNC 7 12.5 #> 16 8 UVA 5 18.5 #> 17 9 UNC 3 12.5 #> 18 9 VT 30 33.5 #> 19 10 UVA 14 18.5 #> 20 10 VT 52 33.5