I have 2 groups (data.frame) in R called good and bad which contains good users and bad users respectively.

The group good contains game_id which is the id for a computergame and number which is how many times this game has been played.

For example good$game_id we get 1 2 3 ... 20. We have 20 games. Similar good$number we get 45214 1254 23 ... 8914 which is the number the game has been played. For example has game_id==1 been played 45214 times in group good.

Similar for bad.
We also have the same number of users in the two groups.



we get

game_id number

1   45214
2   1254
20  8914

I want to investigate if there is dependence between the number of times a fixed computergame has been played.

For game_id==1 I would try to use Pearson's Chi test for 'Independence'. In R I type chisq.test(good[1,2], bad[1,2]) to see if there is indepence between good and bad for game_id==1 but I get an error message: x and y must have same levels.

How can this problem be solved ?

  • $\begingroup$ Can you post the result of head(your_data.frame)? $\endgroup$ – Antoni Parellada Sep 28 '15 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.