state_panel: Create state panel data

Description Usage Arguments Details Value Examples

View source: R/state-panel.R

Description

Create panel data consisting of independent states in the international system.

Usage

1
state_panel(start, end, by = NULL, partial = "any", useGW = TRUE)

Arguments

start

Beginning date for data, see parse_date() for format options.

end

End date for data, see parse_date() for format options.

by

Temporal resolution, "year", "month", or "day". If NULL, inferred from start and end input format, e.g. start = 2006`` implies by = "year"'.

partial

Option for how to handle edge cases where a state is independent for only part of a time period (year, month, etc.). Options include "exact", "first", "last", and "any". See details.

useGW

Use Gleditsch & Ward statelist or Correlates of War state system membership list.

Details

The partial option determines how to handle instances where a country gains or loses independence during a time period specified in the by option:

Value

A base::data.frame() with 2 columns for the country code and date information. The column names and types differ slightly based on the "useGW" and "by" arguments.

Examples

 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
# Basic usage with full option set specified:
gwlist  <- state_panel("1991-01-01", "2015-01-01", by = "year",
                       partial = "any", useGW = TRUE)
head(gwlist, 3)
cowlist <- state_panel("1991-01-01", "2015-01-01", by = "year",
                       partial = "any", useGW = FALSE)
head(cowlist, 3)

# For yearly data, a proper date is not needed, and by = "year" and
# partial = "any" are inferred.
gwlist <- state_panel(1990, 1995)
sfind(265, list = "GW")
265 %in% gwlist$gwcode

# Partials
# Focus on South Sudan--is there a record for 2011, first year of indendence?
data(gwstates)
dplyr::filter(gwstates, gwcode==626)

# No 2011 because SSD was not indpendent on January 1st 2011
x <- state_panel(2011, 2013, partial = "first")
dplyr::filter(x, gwcode==626)

# Includes 2011 because 12-31 date is used for filtering
x <- state_panel("2011-12-31", "2013-12-31", by = "year", partial = "exact")
dplyr::filter(x, gwcode==626)

# Includes 2011 because partial = "any"
x <- state_panel("2011-01-01", "2013-01-01", by = "year", partial = "any")
dplyr::filter(x, gwcode==626)

states documentation built on April 14, 2021, 5:08 p.m.