Useful R Programs
manufacturing_index_1899-1937.r
-- Simple R Program that Illustrates How to do a dual axis Plot
manufacturing_index_1860-1914.txt -- Data read by R Program
figure_3_handout_2D_geometric_2008.r
-- Simple R Program that Illustrates How to put Math symbols in a Plot
book_ch_3_vote1.txt -- Data read by R Program
pew_jan_2010_basicspace.r
-- R Program that Illustrates How to pull Adjacent Columns From a STATA File and put them into
a Matrix
Jan10_political_public.dta -- Pew Survey Data read by
R Program
AM_L-C_2008_CCES.r
-- R Program that Illustrates How to replace NA with 999 in a matrix using the ifelse and
is.na(..) commands. Performs Aldrich-McKelvey Scaling on 2008 CCES 100 point Liberal-Conservative
Scale
CCES_2008.dta -- CCES Survey Data read by
R Program
Annenberg_Therm_2000.r
-- R Program that Illustrates How to use -- myvarname <- which(names(data)=="varname") -- and
-- matrix(unlist(data[myvarname])). Performs BlackBox Transpose on Annenberg Feeling
Thermometers
NAES_DataElec_2000.dta -- Annenberg Survey
Data read by R Program
OC_sen111.r -- Illustrates how to use the gdata
Library to do formatted output
SEN111KH.ord -- Senate Roll
Call Data read by R Program
Brazil_Markwart_1_OC.r -- Illustrates how read STATA file with
missing data, run W-NOMINATE and OC, and write the output to disk using the gdata
Library to do formatted output
Brazil_byname_roll_calls_lower_house_1991-1994.dta
-- STATA file for Brazil Roll
Call Data read by R Program
2010_Ideology_2.r -- Illustrates how to compute
correlations and regression lines when there are "NA"s in the data
DWNOMINATE_ELECTIONS_DATABASE_House.dta -- STATA file
read by R Program
smoothed_histogram_congress_111_dwnom.r -- Illustrates how to
produce smoothed histograms that sum to one so that the relative size of the histograms is correct
handsL_110_111.dat -- Subset of DW-NOMINATE data
read by R Program
bush_gore_non_2000_smoothed_histogram.r -- Illustrates how to
produce smoothed histograms that sum to one so that the relative size of the histograms is correct. Uses data
from a scaling of NES 2000 thermometer data.
ind2000.dat -- Scaled respondents from NES 2000 survey
read by R Program
Lehman_Before_After.r -- Illustrates how to make cross-plot
of two sets of coordinates for the same legislators. Also shows how to compute Pearson R's between various subsets of
coordinates and how to fit a simple regression line through the cross-plot.
HOU_Before_After_Lehman.dat -- W-NOMINATE Coordinates
read by R Program
House_crosstab_110_RC_1110_111_RC_241.r --
Illustrates how to make cross-plot of two roll calls from two different Houses. Program reads:
HOU110KH.ORD -- 110th House Roll Calls
HOU111KH.ORD -- 111th House Roll Calls
plot_sen90_optim.r --
Shows how to combine header from roll call file with coordinates from scaling into a data frame and then write it
out in fixed record format. The trick is to use
formatC to format the coordinates and then
place the coordinates in a matrix that can be placed into a data frame using
as.data.frame and then
written out using
write.fwf. Program reads:
sen90_best_solution.txt -- Simple coordinate output to be
put into data frame.
plot_slice_sen90.r --
Shows how to combine header from roll call file with two sets coordinates from scaling into a data frame and then write it
out in fixed record format. Program produces two panel plot comparing the two input configurations. Program reads:
true_sen90.txt -- Coordinates from Optimizer
poole_sen90.txt -- Coordinates from Slice Sampler
put into data frame.
lattice_test.r --
Shows how to take coordinates in two dimensions and create
Scatterplots with Smoothed
Densities. Program reads:
naes_2008_voters_2.txt -- Annenberg Respondents from an
Optimal Classification analysis of survey respondents' answers to
issue questions.
oprobit_ologit.r -- Program that runs
ordered probit and ordered logit in R using the
polr function. Shows how to do list-wise deletion using the
na.omit() function
double_center_scaling_3.r -- R program that reads a
roll call matrix using the function read.ord <- function(rc.file){....} and uses the function
votetotals <- function(rcdta,minminority=0.025) {...} that checks for roll calls with a pre-set minimum number
of legislators in the minority. The program then uses the apply command to create an agreement score matrix which is analyzed
via eigenvalue-eigenvector and SMACOF using the
smacofSym function.
SEN90KH.ORD -- 90th Senate roll call data
read by the program
VOTEVIEW Blog
NOMINATE Data, Roll Call Data, and Software
Course Web Pages: University of Georgia (2010 - )
Course Web Pages: UC San Diego (2004 - 2010)
University of San Diego Law School (2005)
Course Web Pages: University of Houston (2000 - 2005)
Course Web Pages: Carnegie-Mellon University (1997 - 2000)
Analyzing Spatial Models of Choice and Judgment with R
Spatial Models of Parliamentary Voting
Recent Working Papers
Analyses of Recent Politics
About This Website
K7MOA Log Books: 1960 - 2017
Bio of Keith T. Poole
Related Links