R package for data and code used in "Quantitative Social Science: An Introduction"
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Quantitative Social Science: An Introduction

Travis-CI Build Status

An R package containing the datasets used in

Kosuke Imai. 2017. Quantitative Social Science: An Introduction. Princeton University Press.

See kosukeimai/qss for other supplementary materials and the original data sets.

The website for this package is available at https://kosukeimai.github.io/qss-package


qss is not available from CRAN, install the package from github with:

# if you have not installed the `devtools` package
# install.packages("devtools") 
install_github("kosukeimai/qss-package", build_vignettes = TRUE)


To list all data sets contained in this package:

data(package = "qss")
data(elections, package = "qss") # load the elections data
vignette(package = "qss") # list all vignettes
browseVignettes("qss") # list vignettes and R code
vignette("causality", package = "qss") # show the vignette for the Causality chapter

The Federalist papers text files are in the extdata/federalist directory of the installed package and need to be accessed as follows:

federalist_dir <- system.file("extdata", "federalist", package = "qss")
corpus.raw <- Corpus(DirSource(federalist_dir))

In 1.3.5 "Data Files", several types of data files are discussed. These are included in extdata/:

dir(system.file("extdata", "data_files", package = "qss"))
load(system.file("extdata", "data_files", "UNpop.RData", package = "qss"))
read.csv(system.file("extdata", "data_files", "UNpop.csv", package = "qss"))
read.dta(system.file("extdata", "data_files", "UNpop.dta", package = "qss"))

Build Package and Documentation

To rebuild README.md from README.Rmd:


The site for the package is built using pkgdown:

# devtools::install_github("hadley/pkgdown")