install.packages("mosaic")

We will work through Example 1 from Section 12.3.

library(mosaic)
Table15_df <- rbind(
  do(494)*data.frame(Tap="Agree",Stop="Agree"),
  do(335)*data.frame(Tap="Agree",Stop="Disagree"),
  do(126)*data.frame(Tap="Disagree",Stop="Agree"),
  do(537)*data.frame(Tap="Disagree",Stop="Disagree")
)

Table15 <- tally(~Tap+Stop,data=Table15_df)
Table15
##           Stop
## Tap        Agree Disagree
##   Agree      494      335
##   Disagree   126      537
mcnemar.test(Table15, correct=FALSE)  # Include "correct=FALSE" so continuity correction is not applied
## 
##  McNemar's Chi-squared test
## 
## data:  Table15
## McNemar's chi-squared = 94.753, df = 1, p-value < 2.2e-16

The test statistic is \(\chi^2_0 = 94.753\) and the P-value is less than \(2.2 \times 10^{-16}\), which is 0.00000000000000022 as a decimal.