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
# Descriptive Statistics for Ordinal-Level Variable
#############################################################
library("poliscidata")
#############################################################

# The values of ordinal-level variables can be compared; there is an order to them.
# The immigpo_level variable in the NES dataset is an example of a ordinal-level variable.
# There are more tools for description than we have for nominal-level variables.

cat("Frequency Distribution Table:\n")
freqC(nes$immigpo_level, nes$wt)

cat("\nMode:\n")
wtd.mode(nes$immigpo_level, nes$wt)

cat("\nMedian:\n")
wtd.median(nes$immigpo_level, nes$wt)
Watch & Learn
thumbnail preview
â–º
i
Video tutorial & demo by Barry Edwards for R Companion to Political Analysis, 3rd Ed. (15:50).
 Options for Making Controlled Mean Comparisons With RCPA3's CompmeansC Function
thumbnail preview
â–º
i
From Mike Marin (8:45).
 Importing , Checking and Working with Data
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