In R this test is given by the function ‘mcnemar.test’.
Case-control data may be analyzed this way as well. Suppose you have a set of people
With some rare disease (e.g., a certain type of cancer); these are called the cases. For this
design you match each case with a contol who is as similar as feasible on all important
Covariates except the exposure of interest. Here is a table1: