-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
96 lines (68 loc) · 3.02 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# states
<!-- badges: start -->
[![CRAN versions](http://www.r-pkg.org/badges/version/states)](https://cran.r-project.org/package=states)
[![Coverage status](https://codecov.io/gh/andybega/states/branch/master/graph/badge.svg)](https://app.codecov.io/github/andybega/states?branch=master)
[![R-CMD-check](https://github.com/andybega/states/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andybega/states/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
Create country-year/month/day panels consistent with the COW or Gleditsch & Ward lists of independent states. I mainly use this for merging different data sources:
1. Create a master template that reflects one of the independent states lists.
2. For each data source, normalize to a copy of the master template. Doing this by source makes it easier to identify and address issues like missing values or observation for non-independent states.
3. In the end, merge everything together. Since all the inputs are already normalized to a proper state panel list, there should be no issues.
What the package does:
- It contains the Gleditsch and Ward (G&W) as well as the Correlates of War (COW) state system membership lists.
```{r}
library("states")
data(gwstates)
data(cowstates)
```
- Search them with `sfind`, this can be helpful for manual coding:
```{r}
sfind(260)[, 1:6]
sfind("German")[, 1:6]
```
- You can use it to build a country-year template that matches either the COW or G&W state lists.
```{r}
countries <- state_panel(1991, 2001)
str(countries)
```
- Visualize missing/non-independent cases in your data. See this related [blog post for more details](https://www.andybeger.com/blog/2016-09-13-data-management/).
```{r, fig.height = 5}
data("polity")
str(polity)
plot_missing(polity, x = "polity", ccode = "ccode", statelist = "COW")
```
For the underlying data (missing info requires date input):
```{r}
polity$date <- as.Date(paste0(polity$year, "-01-01"))
mm <- missing_info(polity, x = "polity", ccode = "ccode",
time = "date", period = "year",
statelist = "COW")
head(mm)
```
## Install
The package is on CRAN and can be installed with:
```r
install.packages("states")
```
Or to install from GitHub:
```r
library("remotes")
remotes::install_github("andybega/states")
```
## Citations
For the [Gleditsch and Ward (G&W) state data](http://ksgleditsch.com/statelist.html):
Gleditsch, Kristian S. & Michael D. Ward. 1999. "Interstate System Membership: A Revised List of the Independent States since 1816." International Interactions 25: 393-413.
For the [Correlates of War (COW) state data](https://correlatesofwar.org/data-sets/state-system-membership/):
Correlates of War Project. 2017. "State System Membership List, v2016." Online, https://correlatesofwar.org