-
Notifications
You must be signed in to change notification settings - Fork 11
/
README.Rmd
74 lines (57 loc) · 2.44 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
output: github_document
---
<!-- DO NOT EDIT README.md directly. Edit README.Rmd -->
# Quantitative Social Science: An Introduction
[![Travis-CI Build Status](https://travis-ci.org/kosukeimai/qss-package.svg?branch=master)](https://travis-ci.org/kosukeimai/qss-package)
```{r, include=FALSE}
library("printr")
```
An R package containing the datasets used in
> Kosuke Imai. 2017. **[Quantitative Social Science: An Introduction](http://press.princeton.edu/titles/11025.html)**. Princeton University Press.
See [kosukeimai/qss](https://github.com/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](https://kosukeimai.github.io/qss-package)
## Install
**qss** is not available from CRAN, install the package from github with:
```{r eval=FALSE}
# if you have not installed the `devtools` package
# install.packages("devtools")
library("devtools")
install_github("kosukeimai/qss-package", build_vignettes = TRUE)
```
## Usage
To list all data sets contained in this package:
```{r, eval = FALSE}
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:
```{r eval=FALSE}
library("tm")
federalist_dir <- system.file("extdata", "federalist", package = "qss")
dir(federalist_dir)
corpus.raw <- Corpus(DirSource(federalist_dir))
corpus.raw
```
In 1.3.5 "Data Files", several types of data files are discussed.
These are included in `extdata/`:
```{r eval=FALSE}
library("foreign")
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`:
```{r eval=FALSE}
rmarkdown::render("README.Rmd")
```
The [site](https://kosukeimai.github.io/qss-package) for the package is built using [pkgdown](https://github.com/hadley/pkgdown):
```{r eval=FALSE}
# devtools::install_github("hadley/pkgdown")
pkgdown::build_site()
```