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.
For
head(good)
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 ?
head(your_data.frame)
? $\endgroup$str(good)
andstr(bad)
will tell if that is so. If yes, this part of the question is about R programming and not on topic for this forum. In that case you should go back to how the data entered R and what went wrong there. $\endgroup$