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
library(poliscidata)

# Collapsing numeric variables into roughly equal-sized groups (quantiles)
describe(world$pop_urban)
world$pop_urban.5cat = cut2(world$pop_urban, g=5)

# the next two lines not strictly necessary but should check our work
levels(world$pop_urban.5cat)
freq(world$pop_urban.5cat, plot=F)
Watch & Learn
thumbnail preview
â–º
i
From Data Science with Yan (10:18).
 Use ifelse() Function to Create Dummy Variables and Categorical Variables
thumbnail preview
â–º
i
From David Caughlin (10:57).
 Setting a Working Directory
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