Skip to content

Instantly share code, notes, and snippets.

@widdowquinn
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save widdowquinn/8112c50f1b5ad7e07dd7 to your computer and use it in GitHub Desktop.
Save widdowquinn/8112c50f1b5ad7e07dd7 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(reshape2)
# Load data, and rerank teams by points
data = read.table("SL_points.txt", sep="\t", header=T)
data$old_rank = rank(-data$Old, ties.method="first")
data$bonus_rank = rank(-data$Bonus, ties.method="first")
data$penalty_rank = rank(-data$Penalty, ties.method="first")
# New dataframe of ranked teams under each scheme
tables = data.frame(old = data$Team[order(data$Old, decreasing=T)],
bonus = data$Team[order(data$Bonus, decreasing=T)],
penalty = data$Team[order(data$Penalty, decreasing=T)])
# Melt data for plotting
mdata = melt(data, id='Team', measure.vars=c('Old', 'Bonus', 'Penalty'))
# Plot data
p = ggplot(mdata, aes(x=variable, y=value, group=Team, color=Team))
p + geom_line(size=1) + labs(title="SL 2013 Points", x="Points Scheme",
y="Points")
Team W D L L close Old Bonus Penalty
Huddersfield 21 0 6 2 42 65 38
Warrington 20 1 6 4 41 66 39
Leeds 18 1 8 6 37 62 35
Wigan 17 1 9 5 35 58 31
St Helens 15 1 11 8 31 55 28
Hull FC 13 2 12 5 28 48 21
Catalan 13 2 12 6 28 49 22
Hull KR 13 0 14 5 26 44 17
Bradford 10 2 15 5 22 39 12
Widnes 10 2 15 8 22 42 15
Wakefield 10 1 16 8 21 40 13
Castleford 9 2 16 4 20 35 8
London 5 2 20 3 12 22 -5
Salford 6 1 20 5 13 25 -2
@widdowquinn
Copy link
Author

Data and R file in support of a blog post about Super League table points schemes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment