kickdata<-read.csv("kicks.csv",header = TRUE)#loads the data into the r space unising working directory 
helmean<-mean(kickdata$Helium)#mean of the helium data
airmena<-mean(kickdata$Air)#mean of the air data

helsd<-sd(kickdata$Helium)#standard of the helium data
airsd<-sd(kickdata$Air)#standard of the helium data

medair<-median(kickdata$Air)#median of the air data
medhel<-median(kickdata$Helium)#median of the helium data


maxair<-max(kickdata$Air)#max of the air data 
maxhel<-max(kickdata$Helium)#max of the helium data

minhel<-min(kickdata$Helium)#min of the helium data
minair<-min(kickdata$Air)

airrange<-range(kickdata$Air)
airrange<-airrange[2]-airrange[1]#works out the range of the air data 

helrange<-range(kickdata$Helium)
helrange<-helrange[2]-helrange[1]#same as above for the helium data 
functiontitile<-c("mean","standard deviation","median","max","min","range")#creates a vector for the titles 
#of data frame

airsummary<-c(airmena,airsd,medair,maxair,minair,airrange)#creates vectors for the air data
helsummary<-c(helmean,helsd,medhel,maxhel,minhel,helrange)#creates vectors for the air data

kicksummary<-data.frame(functiontitile,helsummary ,airsummary)#creates the kick summary   
colnames(kicksummary)<- c("function","helium","air")#changes the column name to make more sence 
shapiro.test(kickdata$Kick)
shapiro.test(kickdata$Helium)
boxplot(kickdata$Helium)
bohel<-kickdata$Helium
bohel<-bohel[bohel>20]#removes outliers below 20
boxplot(bohel)
bohel<-bohel[bohel<35]#removes outlieras above 35
boxplot(bohel)#all ouliers removed 

boxplot(kickdata$Air)
boair<-kickdata$Air
boair<-boair[boair>16]
boxplot(boair)

#next i will preform a ttest on this data to see if there is any difference between balls pumped with air and those 
#pumped with helium i beive that there will not be a significant difference 
t.test(bohel,boair)
# the t test result shows there is a signifcant difference between the means at 1.451 this shows that there is a 

# difference as the t test showed under 0.5
neilkickair<-kickdata$Air 
neilkickair<-neilkickair[kickdata$Kick %% 2 == 1]# this filters the data to only show odd kicks
neilkickhel<-kickdata$Helium
neilkickhel<-neilkickhel[kickdata$Kick %% 2 == 1]# this filters the data to only show odd kicks

jonnykickair<-kickdata$Air
jonnykickair<-jonnykickair[kickdata$Kick %% 2 == 0]# this filters the data to only show even kicks
jonnykickhel<-kickdata$Helium
jonnykickhel<-jonnykickhel[kickdata$Kick %% 2 == 0]# this filters the data to only show even kicks


neilmeanair<-mean(neilkickair)
neilmeanair

jonnymeanair<-mean(jonnykickair)
jonnymeanair
#from this we can see that there is a difference between the kickers 



neilmeanhel<-mean(neilkickhel)
jonnymeanhel<-mean(jonnykickhel)

#this is used to find the overall mean for neil 
neiloverall<-c(neilmeanair,neilmeanhel)
neiloverall<-mean(neiloverall)
neiloverall

#this is used to find the overall mean for jonny 
jonnyoverall<-c(jonnymeanair,jonnymeanhel)
jonnyoverall<-mean(jonnyoverall)

#this will display the means 
neiloverall
jonnyoverall

#from this we can see that neil had an average distance of 26.625 while 
#jonny had an overall of 25.8 this shows that there is a difference between the two kickers 
#however the difference is only slight 
t.test(neilkickair,jonnykickair) 
#as the t test comes back above 0.05 this shows that there is significant difference between the two kickers 

