# Name: Kai Harley Strand-Regan #Student no: 1801495 #Task 2 #1.0 kickData<-read.csv("Kicks.csv", header=TRUE) #importing the datasheet and calling it 'kickData' class(kickData) head(kickData) kickData #2.0 #creating each column and adding the row values #mean for both Air and Helium kickSummary <-data.frame("Air Mean" = c(mean(kickData$Air)), "Helium Mean" = c(mean(kickData$Helium)), "Air Standared Deviation"= c(sd(kickData$Air)), "Helium Standared Deviation" = c(sd(kickData$Helium)), "Air Meadian"= c(median(kickData$Air)), "Helium Median" = c(median(kickData$Helium)), "Air Max"= c(max(kickData$Air)),"Helium Max" = c(max(kickData$Helium)), "Air Min" = c(min(kickData$Air)) ,"Helium Min" = c(min(kickData$Helium)), #The range would duplicate the rows if it used the built in function. This method preforms the equivalent to finding the range "Air Range" = c(paste(min(kickData$Air), " - ", max(kickData$Air))), "Helium Range" = c(paste(min(kickData$Helium), " - ", max(kickData$Helium)))) write.csv(kickSummary,"kickSummary.csv", row.names = FALSE) #writing the dataframe to a csv file AirK= kickData$Air #naming the column for easier referencing, AirK = the air column AirK HeliumK= kickData$Helium HeliumK #3.0 #The p-value was 0.4931 more than 0.05 shapiro.test(AirK) #The p-value was 0.00586 less than 0.05, as a result a boxplot is made to find the outliers shapiro.test(HeliumK) #creating box plot to identify outliers in helium boxplot(AirK) # 4 outliers between 10-20 and 1 is 39. The 4 and 1 will be cleaned up so that the data is not skewed. boxplot(HeliumK) #firstly a filter to remove the values under 20 HeliumK<-HeliumK[HeliumK >20] #next to show the values below 39 HeliumK<-HeliumK[HeliumK <39] #checking that they have been removed boxplot(HeliumK) #the new p-value is 0.6405 which is higher than 0.05 shapiro.test(HeliumK) #4.0 #H0: There will be no difference in distance travelled using air in the ball compared to helium #H1: The helium in the ball will increase the distance travelled t.test(AirK, HeliumK) #given that the average of Air (x) is 26 (rounded) and the distance average for helium (y) is 28 then the H0 is rejected.