This is the code I am using, which runs fine in Rstudio
a1 <- matrix(c(1601, 162527, 510, 412368), nrow=2, byrow=T)
chisq.test(a1, correct=F)
This is the error I get
! Undefined control sequence.
<argument> ^^M##^^M## Pearson'
s Chi-squared test^^M##^^M## data: a1^^M## X...
l.356 \end{verbatim}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
It would work if I do
c1 <- chisq.test(a1, correct=F)
then call for the p-value using
c1$p.value
What is causing this problem?