library(tidyverse)
airquality
mydata = data.frame(airquality$Ozone,airquality$Month)
# I first seperated the Ozone and Month Variables from the rest of the data
mydata = na.omit(mydata)
# Then I ommitted all the NA values from this data set 
mydata

Ho: The ozone levels are the same each month

Ha: The ozone levels are different each month

This sets up all the values I will use to calculate the T-score

mydata5 = mydata %>% filter(airquality.Month==5)
N5=26
M5=mean(mydata5$airquality.Ozone)
M5
## [1] 23.61538
S5=sd(mydata5$airquality.Ozone)
S5
## [1] 22.22445
mydata6 = mydata %>% filter(airquality.Month==6)
N6=9
M6=mean(mydata6$airquality.Ozone)
M6
## [1] 29.44444
S6=sd(mydata6$airquality.Ozone)
S6
## [1] 18.2079
mydata7 = mydata %>% filter(airquality.Month==7)
N7=26
M7=mean(mydata7$airquality.Ozone)
M7
## [1] 59.11538
S7=sd(mydata7$airquality.Ozone)
S7
## [1] 31.63584
mydata8 = mydata %>% filter(airquality.Month==8)
N8=26
M8=mean(mydata8$airquality.Ozone)
M8
## [1] 59.96154
S8=sd(mydata8$airquality.Ozone)
S8
## [1] 39.68121
mydata9 = mydata %>% filter(airquality.Month==9)
N9=29 
M9=mean(mydata9$airquality.Ozone)
M9
## [1] 31.44828
S9=sd(mydata9$airquality.Ozone)
S9
## [1] 24.14182

This compares the different months to each other and determines if we reject or fail to reject the null hypothesis

# Comparing Months 5 and 6
((M5-M6)-0)/(sqrt((S5^2/N5)+(S6^2/N6)))
## [1] -0.7801009

with df = 8 the t-statistic is between .4 and .5, so we fail to reject the null and conlcude that there is no difference in the ozone levels between month 5 and 6

# Comparing Months 5 and 7
((M5-M7)-0)/(sqrt((S5^2/N5)+(S7^2/N7)))
## [1] -4.681989

with df = 25 the t-statistic is less than .01, so we reject the null and conlcude that there is a difference in the ozone levels between month 5 and 7

# Comparing Months 5 and 8
((M5-M8)-0)/(sqrt((S5^2/N5)+(S8^2/N8)))
## [1] -4.07488

with df = 25 the t-statistic is less than .01, so we reject the null and conlcude that there is a difference in the ozone levels between month 5 and 8

# Comparing Months 5 and 9
((M5-M9)-0)/(sqrt((S5^2/N5)+(S9^2/N9)))
## [1] -1.252747

with df = 25 the t-statistic is between .2 and .3, so we fail to reject the null and conlcude that there is no difference in the ozone levels between month 5 and 9

# Comparing Months 6 and 7
((M6-M7)-0)/(sqrt((S6^2/N6)+(S7^2/N7)))
## [1] -3.418598

with df = 8 the t-statistic is between .002 and .01, so we reject the null and conlcude that there is a difference in the ozone levels between month 6 and 7

# Comparing Months 6 and 8
((M6-M8)-0)/(sqrt((S6^2/N6)+(S8^2/N8)))
## [1] -3.092206

with df = 8 the t-statistic is between .002 and .01, so we reject the null and conlcude that there is a difference in the ozone levels between month 6 and 8

# Comparing Months 6 and 9
((M6-M9)-0)/(sqrt((S6^2/N6)+(S9^2/N9)))
## [1] -0.2655679

with df = 8 the t-statistic is between .5 and 1, so we fail to reject the null and conlcude that there is no difference in the ozone levels between month 6 and 9

# Comparing Months 7 and 8
((M7-M8)-0)/(sqrt((S7^2/N7)+(S8^2/N8)))
## [1] -0.08501814

with df = 25 the t-statistic is between .5 and 1, so we fail to reject the null and conlcude that there is no difference in the ozone levels between month 7 and 8

# Comparing Months 7 and 9
((M7-M9)-0)/(sqrt((S7^2/N7)+(S9^2/N9)))
## [1] 3.614506

with df = 25 the t-statistic is between .001 and .002, so we reject the null and conlcude that there is a difference in the ozone levels between month 7 and 9

# Comparing Months 8 and 9
((M8-M9)-0)/(sqrt((S8^2/N8)+(S9^2/N9)))
## [1] 3.174831

with df = 25 the t-statistic is between .002 and .01, so we reject the null and conlcude that there is a difference in the ozone levels between month 8 and 9