x <- matrix(c(17, 13, 8, 20), nc = 2)
chisq.test(x,correct = TRUE)
And the results are:
Pearson's Chi-squared test with Yates' continuity correction
data: x
X-squared = 3.5862, df = 1, p-value = 0.05826
I hope this helps, if not, please, show what message R shows you in your code... or show more of your code