league_table: Create league table

View source: R/goalmodel_misc.R

league_tableR Documentation

Create league table

Description

Creates a league table with basic descriptive statistics and number of points.

Usage

league_table(goals1, goals2, team1, team2)

Arguments

goals1

Numeric, non-negative integer. The number of goals scored by team 1.

goals2

Numeric, non-negative integer. The number of goals scored by team 2.

team1

Vector of team names.

team2

Vector of team names.

#' @return A data.frame with one row for each team in the data.

Details

Points are calculated as 3 points for win, 1 for draw, and 0 for loss. Results are sorted by points and ties will be resolved by 1) goal difference and 2) goals scored. Further ties will not be resolved, and the tied teams will be ranked arbitrarily.

Note that leagues and competitions will often have different rules for how teams are ranked, especially for how ties are handled. The results provided by this functions may therefore differ from official league rankings.

Games with missing values in the number of goals scores will be ignored and will therefore not contribute to the table.


opisthokonta/goalmodel documentation built on April 3, 2024, 1:32 a.m.