test_data <- transform(survey_data,
trust_gov_high = as.integer(trust_government >= 4),
trust_media_high = as.integer(trust_media >= 4))
result <- mcnemar_test(test_data, var1 = trust_gov_high,
var2 = trust_media_high)
result # compact one-line overview
summary(result) # full detailed output
Run the code above in your browser using DataLab