NOW AVAILABLE: Essentials of Poltical Analysis 7e | R Companion 4e | SPSS 7e | Stata 5e | Excel 1e 🎵
NOW AVAILABLE: Essentials 7e | R Companion 4e | SPSS 7e | Stata 5e | Excel 1e 🎵
NOW AVAILABLE: Essentials 7e | More Textbooks 🎵

Run R Code Example Online

# Chapter 5: Making Controlled Comparisons
library(poliscidata)  # Loads R companion package in session

# CROSS-TABULATION ANALYSIS WITH A CONTROL VARIABLE

# Starting point, cross-tabulation without control variable
# This xtp command will generate a mosiac plot
cat("Basic Cross-Tabulation:\n")
xtp(gss, divlaw2, attend3, wtss)

# Now we introduce control variable: kids
cat("\n\nCross-Tabulation with Control Variable:\n")
xtabC (~divlaw2 + attend3 + kids, gssD)