#Import the data set labeled as cocowater-1 (note that your data set has headers). Assign to the vector= df1
df2<-read.table("INITIAL SETTLING TIME.txt", header=TRUE)
## Warning in read.table("INITIAL SETTLING TIME.txt", header = TRUE): incomplete
## final line found by readTableHeader on 'INITIAL SETTLING TIME.txt'
#The data needs to be converted into a single vector. Use the as.matrix function on the vector, then transpose by using the “t” function as you concatenate and assign to r
r<-c(t(as.matrix(df2)))
# Assign to f the treatment levels to f
f<-c("T1", "T2", "T3", "T4", "T5")
#Assign to k the number of treatment levels
k<- 5
#Assign to n the number of observations per treatments
n<-3
#Generate levels using the gl function on the basis of:
#Number of treatment levels
#Number of primary factors
#n*k
#factors as the treatment levels
tm<-gl(k, 1, n*k, factor(f))
#Subject to anova using the aov function the data set you have established (r) to the treatment factors (tm)
av2<- aov(r~tm)
summary(av2)
## Df Sum Sq Mean Sq F value Pr(>F)
## tm 4 33988 8497 2125 1.34e-14 ***
## Residuals 10 40 4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(av2)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = r ~ tm)
##
## $tm
## diff lwr upr p adj
## T2-T1 40.19333 34.81986 45.56681 0e+00
## T3-T1 71.15333 65.77986 76.52681 0e+00
## T4-T1 105.99667 100.62319 111.37014 0e+00
## T5-T1 135.15333 129.77986 140.52681 0e+00
## T3-T2 30.96000 25.58653 36.33347 0e+00
## T4-T2 65.80333 60.42986 71.17681 0e+00
## T5-T2 94.96000 89.58653 100.33347 0e+00
## T4-T3 34.84333 29.46986 40.21681 0e+00
## T5-T3 64.00000 58.62653 69.37347 0e+00
## T5-T4 29.15667 23.78319 34.53014 1e-07