View source: R/goalmodel_misc.R
league_table | R Documentation |
Creates a league table with basic descriptive statistics and number of points.
league_table(goals1, goals2, team1, team2)
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. |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.