I am trying to use a chi-square test with a crosstab of different survey answers. The answers are categorical but they are represented by numbers.
Below is an example:
1 2 3 4
1 368 768 346 155
2 213 598 286 140
3 528 2047 1293 501
4 910 2953 1764 806
5 1579 7448 7489 4259
6 961 4851 6481 7944
I have tried several examples of the chisq.test but have encountered error messages every time. I think ideally I would like to run the test in a loop for each possibility (see below code).
CHIS <- lapply(df[,-1], function(x) chisq.test(Q5_Q8.1[,1], x))
With this code above I got the following error: "Chi-squared approximation may be incorrect."
I'm still new to R and still learning how to do a lot of statistics, so any help in the best way to approach this would be great. Thanks ahead of time!