Untitled
2 years ago in Plain Text
my_dataEPL <- read.csv("C:/Users/shame/OneDrive/Desktop/Research Paper/R studio/FullEPL.csv")
View(my_dataEPL)
my_dataEPL <- subset(my_dataEPL, HTR!="D")
my_dataEPL <- subset(my_dataEPL, FTR!="D")
View(my_dataEPL)
# Basically just subsetting a few times over. Removing Draws from the HTResult and FTResult,
# then only counting instances where the HTResult is the same as the FTResult
HTMomentum <- my_dataEPL[c("HomeTeam", "AwayTeam", "HTR", "FTR")] %>%
subset(FTR!= "D") %>%
subset(HTR!="D") %>%
subset(HTR==FTR)
view(HTMomentum)
#This is counting where the HTResult does not match the FTresult, I just called it an 'upset'
HTUpset <- my_dataEPL[c("HomeTeam", "AwayTeam", "HTR", "FTR")] %>%
subset(FTR!= "D") %>%
subset(HTR!="D") %>%
subset(HTR!=FTR)
View (HTUpset)
#This counts how often a draw at HT leads to a draw at FT
HTMomentumDraws <- my_dataEPL[c("HomeTeam", "AwayTeam", "HTR", "FTR")] %>%
subset(FTR=="D") %>%
subset(HTR=="D") %>%
subset(HTR==FTR)
View(HTMomentumDraws)
#Using a histogram to show that teams that win in the half time results, generally win in the full time results.
HalfTimeResults_freq <- table(my_dataEPL$HTR)
view(HalfTimeResults_freq)
#away winnings in HTR
my_dataEPL2 <- subset(my_dataEPL, HTR!="H")
#teams that won in the FTR where away won in the HTR
FullTimeResults_freq_away <- table(my_dataEPL2$FTR)
view(FullTimeResults_freq_away)
#data where home won in the HTR
my_dataEPL3 <- subset(my_dataEPL, HTR!="A")
#Team that won in the FTR where home won in the HTR
FullTimeResults_freq_home <- table(my_dataEPL3$FTR)
#Grouped Bar graph
HTMdata <- table(FullTimeResults_freq_home, FullTimeResults_freq_away)
FullTimeResults_freq_away
FullTimeResults_freq_home
View(HTMdata)
?barplot
HTMdata <- table(HTMdata)
class(HTMdata)
View(HTMdata)
barplot(600,HTMdata, beside=TRUE, width=5,).
FullTimeResults_freq_away
a <- FullTimeResults_freq_home["H"]
b <- FullTimeResults_freq_home["A"]
xH <- c(a,b)
percentlabels_H <- round(100*xH/sum(xH), 1)
HomePieLabels <- paste(percentlabels_H, "%", sep="")
HomePie <- pie(xH, labels = HomePieLabels,
main="Home Team Half Time Momentum",
col=rainbow(length(xH)))
Home_Legend <- legend("topright", c("Home Team wins at FT", "Home Team lose at FT"),
cex=1,
fill=rainbow(length(xH)))
c <- FullTimeResults_freq_away["A"]
d <- FullTimeResults_freq_away["H"]
xA <- c(c,d)
percentlabels_A <- round(100*xA/sum(xA), 1)
AwayPieLabels <- paste(percentlabels_A, "%", sep="")
AwayPie <- pie(xA, labels=AwayPieLabels,
main="Away Team Half Time Momentum",
col=rainbow(length(xA)))
Away_Legend <- legend("topright",c("Away Team wins at FT","Away Team lose at FT"),
cex=1,
fill=rainbow(length(xA)))