#1704446 - Christine Woods


#kicksdata loaded with headings making sure the
#names are imported as a factor

kicksdata<-read.csv("kicks.csv", header=TRUE,stringsAsFactors = FALSE)   
kicksdata



#create vectors to place into a dataframe to show statistics with headings
#the range pulls back two values, value one is subtracted from value two
#to give the rangevalue.
#each vector is then put into a data frame

Measure<-c("Mean","SD","Median","Max","Min","Range","RangeValue")
Airvalues<-c(mean(kicksdata$Air),
             sd(kicksdata$Air),
             median(kicksdata$Air),
             max(kicksdata$Air),
             min(kicksdata$Air))
            
AirRange<-range(kicksdata$Air)
RangeValue<-AirRange[2]-AirRange[1]
AirRange
RangeValue

Airvalues<-c(Airvalues,AirRange)
Airvalues

Heliumvalues<-c(mean(kicksdata$Helium),
                sd(kicksdata$Helium),
                median(kicksdata$Helium),
                max(kicksdata$Helium),
                min(kicksdata$Helium))

HeliumRange<-range(kicksdata$Helium)
RangeValue<-HeliumRange[2]-HeliumRange[1]
HeliumRange
RangeValue

Heliumvalues<-c(Heliumvalues,HeliumRange)
Heliumvalues

kicksSummary<-data.frame(Measure,Airvalues,Heliumvalues)
kicksSummary



#Shapiro test is used to show normality with a boxplot to identify
#any outliers showing the data as normal. The P value shows to be greater
#than 0.05 and therefore the data is distributed normally.
#The boxplots show the data and how it is distributed with no outliers
#This now means we can use the data for a t-Test

shapiro.test(Airvalues)
shapiro.test(Heliumvalues)


boxplot(Airvalues, main="Air Values")
boxplot(Heliumvalues, main="Helium Values")



#H0: There is no difference between the means, i.e. both sets of values have the same 
#    kicking difference
#H1: There is a difference between the means, i.e. one of the balls is kicked further

#The t.test result show p-value of 0.9422.  This is more than 0.05 so the null hypothesis
#cannot be rejected.  Therefore we accept the null hypthesis that there is no difference
#between the mean of both types of ball and no difference in the kicks depending on whether
#they are filled with air or helium.


t.test(Airvalues,Heliumvalues)












