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(~modsex_scale, ~link_wom_scale + dem_raceeth2, nesD)

# Next commands create plot with legend
iplotC(~modsex_scale, ~link_wom_scale+dem_raceeth2, nesD,
       modsex_scale~dem_raceeth2+link_wom_scale,
       xlab="Linked Fate Scale", ylab="Modern Sexism Scale",
       main=list("Modern Sexism Opinions by \n Linked Fate and Race", cex=1.2))
legend("topleft", legend=c("Black","White"), lty=c(2,1), lwd=2, 
       title="Race", inset=0.1, bty="n")
Watch & Learn
thumbnail preview
â–º
i
From Mike Marin (6:40).
 Dummy Variables or Indicator Variables
thumbnail preview
â–º
i
From David Caughlin (33:48).
 Gentle Introduction to R
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