Skip to content
Prev 39971 / 398498 Next

chisq.test error: x and y must have at least 2 levels

Christoph Bier <christoph.bier at web.de> writes:
Well, the error message might be slightly beside the point, but the
issue would seem to be that there are no "ja"'s inside either vector.
I.e. it first reduces each factor to those levels that are actually
present, then checks whether there are at least two levels.

You can't do a chisquare test on a table that looks like this

      nein   ja
nein    42    0
  ja     0    0