mcnemar.test(x, y=NULL, correct=T)
Conversely, if x or y is not a factor/category object (and x is not a matrix), it will be coerced to one implicitly. In this case pairs (x[i],y[i]) containing NAs will be removed, but not pairs with Infs. Coercion of x and y in this manner is intended for datasets of mode numeric, whose elements are typically small integers; data in the form of character vectors should first be made into factor or category objects.
Under the null hypothesis, McNemar's statistic has an asymptotic chi-square distribution with degrees of freedom given by R*(R-1)/2, where R is the number of rows of the contingency table.
Zar, J. H. (1984). Biostatistical Analysis, 2nd ed. Englewood Cliffs: Prentice-Hall.
x # x and y are category objects [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 [33] 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [65] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [97] 2 2 2 2 attr(, "levels"): [1] "Present" "Absent" table(x,y) # table from Fleiss, p. 114 Present Absent Present 15 20 Absent 5 60 mcnemar.test(x,y) mcnemar.test(table(x,y)) # same thing