PS2_data <- read.csv("ProbSet2Data.csv")
df <- PS2_data[c(1:58),c(1,16)]

Changing ID variable into a factor

df$id <- as.factor(df$id)
levels(df$id) <- list(Male = "2", Female = "1")
table(df$id)
## 
##   Male Female 
##     29     29
df$search_eyex_mean <- as.factor(df$search_eyex_mean)
levels(df$search_eyex_mean) <- list(HighMovement = "2", 
                                    LowMovement = "1")
table(df)
##         search_eyex_mean
## id       HighMovement LowMovement
##   Male             10          19
##   Female           14          15

Here I am making a table of my data

ChiSquarTable <- table(df)

Here I am running the chi square test

chiSq <- chisq.test(ChiSquarTable)

Next I am looking at the results of the test

chiSq$statistic
## X-squared 
## 0.6397059

Next I am looking at the p-value

chiSq$p.value
## [1] 0.4238173

Finally, just for practice I am looking at the residuals

chiSq$residuals
##         search_eyex_mean
## id       HighMovement LowMovement
##   Male     -0.5773503   0.4850713
##   Female    0.5773503  -0.4850713