Learn R Programming

mariposa (version 0.7.3)

print.mcnemar_test: Print McNemar test results (compact)

Description

Compact print method for objects of class "mcnemar_test". Shows a one-line summary with the McNemar chi-square statistic, the asymptotic and exact p-values, and sample size.

For the full detailed output (2x2 contingency table, test results, discordant pairs), use summary().

Usage

# S3 method for mcnemar_test
print(x, digits = 3, ...)

Value

Invisibly returns the input object x.

Arguments

x

An object of class "mcnemar_test"

digits

Number of decimal places (default: 3)

...

Additional arguments (currently unused)

Examples

Run this code
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