FIND DATA: By Author | Journal | Sites   ANALYZE DATA: Help with R | SPSS | Stata | Excel   WHAT'S NEW? US Politics | Int'l Relations | Law & Courts
   FIND DATA: By Author | Journal | Sites   WHAT'S NEW? US Politics | IR | Law & Courts
Run R Code
About This Page
This page features live demonstrations of the R Statistics Program used for political science research.
  • To run example, click the Run button.
  • To copy example code, click the Copy button.


See More R Demos
Run R Code in Your Web Browser
# Chapter 5: Making Controlled Comparisons
library(poliscidata)  # Loads R companion package in session

# MEAN COMPARISON ANALYSIS WITH A CONTROL VARIABLE 

cat("Controlled Mean Comparison Table:\n")
imeansC(~ft_dem, ~gender + married, nesD)

# Next commands create plot with legend
iplotC(~ft_dem, ~gender+married, nesD, ft_dem~married+gender,
       xlab="Gender", ylab="Democratic Party Rating",
       main="Democratic Party Ratings\nby Gender and Marital Status")
legend("topleft", legend=c("No","Yes"), lty=c(1,2), lwd=2, 
       title="Is R married?", inset=0.1, bty="n")
Watch & Learn
thumbnail preview
â–º
i
From David Caughlin (6:03).
 Creating & Saving an R Script
thumbnail preview
â–º
i
From Mike Marin (6:22).
 Logistic Regression Models
MORE VIDEOS: See Video Channels for more political science videos!
LEARN HOW: Watch Lecture Videos for Essentials of Political Analysis, Video Tutorials for R, Stata, SPSS, and Excel